I’m this code embed my js file for win key close. This codes:
jQuery(document).keydown(function(e){
alert(e.keyCode); // replace "37" below with the windows key code
if (e.keyCode == 37) {
alert( "windows key pressed" );
return false;
}
});
Working good. But i want only work 1 div. How can i do this?
Add the selector instead of document
jQuery('selector')instead ofjQuery(document)where selector can be anything like id, class e.t.c
Demo which uses selector as id
Another Demo will work for only one input inside a div.
Div Demo will work only for first div
Disabled for Div will work only for span not for div
Disabled for input in div will work for all input if they are not inside a div