The focus method will support in all browser.
Example :At first we have created a html page in which there are two text boxes and two buttons. Now, when user click on first button then focus is set to first text box and when the user click on second button then the focus will set to second text box.
Output from the program is as follows:
When you click on button "Click to Focus on first textbox" then focus will beset to the first text box as you can see in the below output:
And, when you click the button "Click to Focus on second textbox" the focus will set to the second text box as you can see the below output:
Liked it! Share this Tutorial