Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: How to set the focus in an element using Javascript?
Answer: <script> function setFocus() { if(focusElement != null) { document.forms[0].elements["myelementname"].focus(); } } </script>
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook