I am having plenty of key events here on my page.Is there any way to disable all the keyup/keydown/keypressed events present on page rather than disabling each event separately. i am looking for solution using javascript/jquery.
Thanks!!
I am having plenty of key events here on my page.Is there any way to disable all the keyup/keydown/keypressed events present on page rather than disabling each event separately. i am looking for solution using javascript/jquery.
Thanks!!
You could do it this way, though I expect it might be horrendously slow on larger pages:
That's going to select every single element on the page, then remove any
keyup
,keydown
, andkeypress
events that are bound to them.If you want to prevent the user from using the backspace key to navigate to the previous page, you could try the following code:
That should restrict the use of the backspace key, except in instances where the focus is an input element where you can enter text (so an
<input type="text">
or a<textarea>
).Take a look at this working demo.
you can use preventDefault() function to solve it
For me worked this combination:
Turn on keypress event
and for turning off this event I have used:
This code deletes the last key pressed in TextBox2, by using substr.
$('*').unbind('keyup keydown keypress')
Try
and you should put this into the
$(document).ready()
block, after all the loaded JS on page (before</body>
tag, for example).