HTML <input> autofocus eigenschap
Definitie en gebruik
autofocus
Eigenschap bepaalt dat het input-element automatisch het focus krijgt bij het laden van de pagina.
autofocus
Eigenschap is een booleaanse eigenschap.
Als deze eigenschap is ingesteld, bepaalt deze dat het <input>-element automatisch het focus krijgt bij het laden van de pagina.
Example
Let the "First name" input field automatically gain focus when the page loads:
<form action="/action_page.php"> <label for="fname">Name:</label> <input type="text" id="fname" name="fname" autofocus><br><br> <label for="lname">Surname:</label> <input type="text" id="lname" name="lname"><br><br> <input type="submit"> </form>
Syntax
<input autofocus>
Browser support
The numbers in the table indicate the first browser version to fully support this property.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
5.0 | 11.0 | 4.0 | 5.0 | 9.6 |
Note:autofocus
Properties are new properties in HTML5.