Expert JavaScript Developer Question:
Download Job Interview Questions and Answers PDF
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>
Download Expert JavaScript Developer Interview Questions And Answers
PDF
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? |