Quantcast
Channel: User Balaji - Stack Overflow
Viewing all articles
Browse latest Browse all 36

Answer by Balaji for How can I set focus on an element in an HTML form using JavaScript?

$
0
0

window.onload is to put focus initiallyonblur is to put focus while you click outside of the textarea,or avoid text areablur

<textarea id="focus"></textarea><script>  var mytexarea=document.getElementById("focus");  window.onload=function() {    mytexarea.focus();  }</script>

Viewing all articles
Browse latest Browse all 36

Latest Images

Trending Articles





Latest Images