How to set the focus on a html element ?
I use document.getElementById('ID_HTML_wanted').focus(); but my html element “ID_HTML_wanted” as not the focus. I user jquery api .focus
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.
Try to wrap your code to this code so it executes AFTER DOM is ready
so it will become
However, your element’t don’t have .focus() method, if you want to REALLY use jQuery’s one, use