Is it possible to programmatically change the value of the document.activeElement property in JavaScript?
Is it possible to programmatically change the value of the document.activeElement property in JavaScript?
Share
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.
In IE, use the
setActive()method of the element that you want to be the active element. In other browsers that supportactiveElement, you can use thefocus()method of the element, so long as the element is capable of receiving the focus (form elements, editable elements, elements withtabindexset).If you want to set the activeElement back to the default (the
<body>element in most browsers), just call the active element’sblur()method: