I am new to jQuery and am trying to fire a function on a keyPress if there are NO inputs selected. I am having trouble with testing for focus. Below is what I currently have but it isn’t working correctly. Any advice?
var inputHasFocus = false;
$('#myForm :input').each(is(":focus")){
inputHasFocus = true;
};
if (inputHasFocus == false){
$("*").keypress(function (e) {
// the function
});
}
Something like that.