JQuery disabled and read-only---> Anti-riot handling

Source: Internet
Author: User

The jquery API provides a way to apply disabled and ReadOnly attributes to elements, which are documented here. As follows:
1.readonly
$ (' input '). attr ("ReadOnly", "ReadOnly")//The INPUT element is set to ReadOnly
$ (' input '). Removeattr ("readonly");//Remove the ReadOnly attribute of the INPUT element

if ($ (' input '). attr ("readonly") ==true)//Determine if the INPUT element has the ReadOnly attribute set

There are two ways to set the ReadOnly property for an element and to cancel the ReadOnly property:
$ (' input '). attr ("ReadOnly", True)//sets the INPUT element to ReadOnly
$ (' input '). attr ("ReadOnly", False)//Remove the ReadOnly attribute of the INPUT element

$ (' input '). attr ("ReadOnly", "ReadOnly")//The INPUT element is set to ReadOnly
$ (' input '). attr ("ReadOnly", "")//Remove the ReadOnly attribute of the INPUT element
2.disabled

$ (' input '). attr ("Disabled", "disabled")//The INPUT element is set to Disabled
$ (' input '). Removeattr ("Disabled");//Remove the disabled attribute of the INPUT element

if ($ (' input '). attr ("disabled") ==true)//Determine if the INPUT element has the disabled attribute set

There are two ways to set the disabled property for an element and to cancel the disabled property:
$ (' input '). attr ("Disabled", true)//sets the INPUT element to disabled
$ (' input '). attr ("disabled", false)//Remove the disabled attribute of the INPUT element

$ (' input '). attr ("Disabled", "disabled")//The INPUT element is set to Disabled
$ (' input '). attr ("Disabled", "")//Remove the disabled attribute of the INPUT element

JQuery disabled and read-only---> Anti-riot handling

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.