i m binding keyup function in jquery to body which works in every browser except firefox
the code: -
$('body').bind('keyup', function(e) {
//alert ( e.which );
alert('testing');
});
how do i do it for firefox. it does not responds at all
thanks
The keyup event is fired when a key is released. The keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. For example, a lowercase "a" will be reported as 65 by keydown and keyup , but as 97 by keypress .
The keyup() is an inbuilt method in jQuery which is used to trigger the keyup event whenever User releases a key from the keyboard. So, Using keyup() method we can detect if any key is released from the keyboard.
You should add a input event. It works on both mobile and computer devices.
bind the event to the document
instead:
$(document).bind('keyup', function(e) {
alert('testing');
});
You can make almost any node receive keyboard events. In "modern" browsers, you can setup a tabIndex
. After that the event is focusable.
$(document.body).attr('tabIndex', 1).bind('keyup', function(e) {
alert('testing');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With