What i find myself?
Posts tagged inputbox
jQuery – Keypress event management with inputbox on page
Apr 25th
While we work with keypress events on a page with input fields, We will get issues while we have something to type on the input boxes.
What we do is we just need to disable the triggers on focus of input box
See the below code
jQuery(document).bind('keypress', function(e) { // This function will help us to prevent trigger if(!jQuery(e.target).is(":input")){ if(e.which == '114'){ // your code } } });
We can use jQuery(e.target).is(“:input”) to find the key is focused on input fields.
Thanks