I am new to jquery and am trying to fire a function on a keyPress if there are NO inputs selected. but 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
});
}