HTML Prohibit text box input

Source: Internet
Author: User

To prevent text box input several commonly used label input has several properties, namely ReadOnly, disabled, AutoComplete, below or to see the use of these tags.

HTML Block input text box

The ReadOnly property stipulates that the input field is read-only. Read-only fields cannot be modified. However, users can still switch to the field by using the TAB key, and can also select or copy their text.

<input readonly= "readonly" value= "xxxx"/>

Write code to add the Type= "Text property:

<input type= "text" name= "www.xxx" readonly= "readonly"/>

The Disabled property stipulates that the input element should be disabled. The disabled INPUT element is neither available nor clickable, nor can it be selected. You can set the disabled property until certain other conditions are met (for example, a check box is selected, and so on). Of course, we can also use JavaScript to remove the disabled value and switch the INPUT element's value to usable.

<input disabled= "Disabled" value= "xxxx"/>

Write code to add the Type= "Text property:

<input type= "text" name= "www.xxx.com" disabled= "disabled"/>

Second, the CSS shielding input does not enter: CSS code is as follows:

<input style= "ime-mode:disabled" >

Third, the front has involved AutoComplete this attribute, in fact this attribute can also be used here to let the text box to prohibit input. The specific code is as follows:

<input type= "text" autocomplete= "Off" id= "number"/>

AutoComplete Explanation: The property of input AutoComplete defaults to ON. The meaning of this means that the browser automatically records the values entered before. Many times, the customer's information needs to be kept confidential to prevent browser software or malicious plug-ins from acquiring it. You can include autocomplete= "off" in input to close the record, so you can use this parameter if you do not allow input input or if the system needs to be kept secret.

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.