The enter key is only registered on a keypress event in IE and
Webkit--so use keypress instead.

-Dan

On Mon, Jan 5, 2009 at 6:20 AM, s0h0 <simon.rueckert....@siemens.com> wrote:
>
>
> Hello,
>
> i tried to use jQuery for cross browser compatibility...I want to execute a
> click on a Button when Enter got pressed on page...
>
> but the following script still only works in FireFox and not in IE.
>
> can anyone help me or have an idea?
>
>
> <script type="text/javascript" src="jquery.js"></script>
> <script type="text/javascript">
>
>     $(document).ready(function() {
>
>         $(document).keydown(function(evt) {
>             if (!evt)
>                 evt = window.event;
>             if (evt.keyCode == 13) {
>                 // alert("enter captured from IE");
>                 $("btnCanelEditUser").click();
>             }
>             else if (evt.which == 13) {
>                 //    alert("enter captured from Gecko, Opera");
>                 $("btnCanelEditUser").click();
>             }
>         });
>
>     });
>
> </script>
> --
> View this message in context: 
> http://www.nabble.com/%24%28document%29.keydown-only-works-in-FireFox--tp21289326s27240p21289326.html
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.
>
>

Reply via email to