JavaScript General - How to set the focus in an element using JavaScript?
Interview Question Database For Software Developers
|
|
| How to set the focus in an element using JavaScript? | | How to set the focus in an element using JavaScript? | | By: |
Use the "focus()" method of the element object:
<script>
function setFocus() {
if(focusElement != null) {
document.forms[0].elements["myelementname"].focus();
}
}
</script>
| | ID: 2129 | Rank: 309 | Votes: 1 | Views: 103 | Submitted: 20080819 |
Copyright © 2008 FYIcenter.com
All rights in the contents of this Website are reserved by the individual author.
No part of the contents may be reproduced in any form without author's permission.
|
|
|