Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p>In this example, the text field gets focus immediately after the document window has been loaded.</p>
 
<input type="text" id="myText" value="A text field">

<script>
window.onload = function() {
  document.getElementById("myText").focus();
};
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy