How to complete the autofocus and placeholder text of HTML5 registration form
This article introduces how to complete the automatic focus and space-occupying text of the HTML5 registration form, the content is very detailed, interested friends can refer to, hope to be helpful to you.
First, take a look at the following sample code to use HTML autofocus and placeholder text
The code is as follows:
2: register account new user register mailbox username display name password confirmation password
Use autofocus
To use HTML5's autofocus function, simply add the autofocus attribute to the form field
For example, you want the cursor to be automatically positioned over the first form field mailbox of the form when the page is loaded and to improve input efficiency.
The code is as follows:
Mail box
It is important to note that if multiple autofocus attributes are set on the page, the user's cursor will only be located over the last form field where the autofocus attribute is set.
Use placeholder text
The greatest use of placeholder text is to explain to the user how to fill out the form correctly. That is, the input prompt is made. To use placeholder text, simply add the placeholder attribute to the input field
The following is the input form field that uses the placeholder attribute
The code is as follows:
Mailbox user name display name password confirmation password
The running effect is as follows
Whether to enable autocomplete
The autocomplete attribute is introduced in HTML5. Used to inform the browser whether the current form field is automatically populated with data. Some browsers remember the data that the user entered before, and in some cases, we may not want the user to use the record data, especially such as passwords.
Turn off autocomplete
The code is as follows:
Autocompletion can be prevented simply by setting the value of atuocomplete to off.
On how to complete the HTML5 registration form of automatic focus and placeholder text to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.