Expert JavaScript Developer Question:
How to set focus in an element using Javascript?
Answer:
Setting the focus in an element using JavaScript:
<script>
function setFocus() {
if(focusElement != null)
{
document.forms[0].elements["myelementname"].focus();
}
}
</script>
<script>
function setFocus() {
if(focusElement != null)
{
document.forms[0].elements["myelementname"].focus();
}
}
</script>
Previous Question | Next Question |
How to get contents of an input box using JavaScript? | How you can access an external JavaScript file that is stored externally and not embedded? |