Home > DeveloperSection > Interviews > How to set the focus in an element using Javascript?

Posted on    March-18-2011 12:00 AM

 JavaScript JavaScript 
Ratings:
 1 Answer(s)
  1200  View(s)
Rate this:

Amit Singh

Total Post:565

Points:2825
Posted on    March-18-2011 12:00 AM

Setting the focus in an element using JavaScript

<script>
function setFocus() {
if(focusElement != null)
{
document.forms[0].elements["myelementname"].focus();
}
}
</script>

Don't want to miss updates? Please click the below button!

Follow MindStick