I have the following event handler
document.addEventListener('keydown', handleBodyKeyDown, false);
HOW DO i prevent it from occurring when inside a input box
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Within your
handleBodyKeyDownfunction, check if(or
'TEXTAREA').Note: For older versions of IE, use
event.srcElement.tagName.Like so:
P.S. Why are you using
addEventListenerif you have jQuery on the page? In jQuery, all of this gets sorted out for you: