Original text: HTML5 autofocus Attribut
Original publication time: August 27, 2012
Translation time: August 6, 2013
HTML5 has launched a lot of wonderful features Something for us.
In the past we had to use JavaScript and Flash to complete tasks, such as form validation, input box blank prompts (INPUT placeholders), client side file upload and download (client side file naming) , as well as audio/video playback, can now be accomplished with basic HTML. Another simple HTML feature now allows us to automatically set input focus to the desired element after the page has finished loading, via an attribute called autofocus.
The code is as simple as: