开发者

Div bind click using Jquery doesn't react on keypress

I'm using jQuery bind for click event on div elements. I want to make it accessible, so I assigned tabindex for div. Which is probably not XHTML valid, but at least tab is stopping where I want. The problem is, that pressing ender key is not triggering event in Firefox (5). In opera it works. Here is the example:

http://jsfiddle.net/NSpb3/13/

Input works for both click and enter key.

Tha开发者_如何转开发nk you.


hey try this http://greatwebguy.com/programming/dom/default-html-button-submit-on-enter-with-jquery/

And code: http://jsfiddle.net/NSpb3/17/


You're binding 'click', which is NOT a key press? If you wan't to register the enter-key for you div, you should bind the keyup event and check if the user has pressed enter.


There's nothing in your code that binds a key press event to the div. This works:

http://jsfiddle.net/NSpb3/16/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜