Home > Web Front-end > HTML Tutorial > How to set focus on HTML elements

How to set focus on HTML elements

高洛峰
Release: 2017-02-27 11:27:02
Original
1826 people have browsed it

HTML elements are mostly set using the focus method of js. There is an example below, you can refer to it

<body 
<form action="" method="post" name="form1" > 

<input type="text" id="id" /> 

</form> 

</body> 

<script> function myfocus() { document.getElementById(&#39;id&#39;).focus(); } </script>
Copy after login

For more related articles on how to set the focus of HTML elements, please pay attention to the PHP Chinese website !

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template