HTML5 registry ticket autofocus and placeholder text example code _ html5 tutorial tips-

Source: Internet
Author: User
I think you have some knowledge about the automatic focus and placeholder text of HTML5. To use the automatic focus function of HTML5, you only need to add the autofocus attribute in the form field, first, let's take a look at the sample code that uses HTML auto-focus and placeholder text. If you are interested, let's take a look at the sample code that uses HTML auto-focus and placeholder text.

The Code is as follows:


2:

Register an account







Use auto focus
To use the auto-focus function of HTML5, you only need to add the autofocus attribute to the form field.
For example, when the page is loaded, the cursor is automatically directed to the first form field mailbox of the form and the input efficiency is improved.

The Code is as follows:



  • Mail Box




  • Note that if multiple autofocus attributes are set on the page, the user's cursor will only be located in the form field with the last autofocus attribute.
    Use placeholder text
    The most useful of placeholder text is to explain to the user how to enter the form correctly. Enter the prompt. To use placeholder text, you only need to add the placeholder attribute in the input domain.
    The following is the input form field using the placeholder attribute.

    The Code is as follows:




    1. Mail Box



    2. User Name



    3. Display name



    4. Password



    5. Confirm Password




    The running effect is as follows:

    Enable Automatic completion?
    The autocomplete attribute is introduced in HTML5. It is used to notify the browser whether to automatically fill in data for the current form field. Some browsers will remember the data that users have previously entered. In some cases, we may not want users to use record data, especially those similar to passwords.
    Turn off auto-completion

    The Code is as follows:




    You only need to set the atuocomplete value to off to Prevent Automatic completion.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.