How to use focus in html
This article mainly explains "how to use focus in html". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use focus in html.
In html, focus means "focus", the focus () method is used to set the focus for the element, and the syntax is "HTMLElementObject.focus ()"; the focus set by the element through the focus () method can be removed by the blur () method.
The operating environment of this tutorial: windows10 system, html5&&javascript1.8.5 version, Dell G3 computer.
What is the use of focus in html
The focus () method is used to set the focus for the element, if it can be set.
The syntax is:
HTMLElementObject.focus ()
Examples are as follows:
one hundred and twenty three
Click the button to set or remove the focus of the above text field.
Function getfocus () {document.getElementById ("myText") .focus ();} function losefocus () {document.getElementById ("myText") .blur ();}
Output result:
At this point, I believe you have a deeper understanding of "how to use focus in html". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!