3

i binded some keys via .keypress() but they should not be binded if one of my input fields is focused so I googled a bit and found that Using jQuery to test if an input has focus

I don't know what I'm doing wrong but I don't get this working.

-> http://jsfiddle.net/DzAwn/10/

$(document).ready(function() {
if (!($("input").is(":focus"))) {
    alert('not focused');
}

});

There should be a workaround with variables and .focus(), but I think the way I tried is the easiest, if it's working....

Need your help! :)

1

1 Answer 1

2

You didn't include jQuery (upper select box in left sidebar). It should work then.

Sign up to request clarification or add additional context in comments.

1 Comment

Sorry, that was stupid. But I just figured out that I need to use .focus() and .blur() to set a boolean variable. Because I need to get it checked all the time and in the example on top it only gets checked once... that was stupid... sorry =/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.