I need to get the newly focussed element (if any) while executing an onBlur handler.
How can I do this?
I can think of some awful solutions, but nothing which doesn’t involve setTimeout.
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.
Reference it with:
document.activeElementUnfortunately the new element isn’t focused as the blur event happens, so this will report body. So you are gonna have to hack it with flags and focus event, or use setTimeout.
Works fine.
Without setTimeout, you can use this:
http://jsfiddle.net/RKtdm/