jquery Batch Set properties ReadOnly and Disabled methods

Source: Internet
Author: User

There are many ways to

  batch set properties, and in this article, you can use jquery to set readonly and disabled properties in bulk

The jquery API provides a way to apply disabled and ReadOnly attributes to elements, recorded here. The following:  1.readonly  code is as follows: $ (' input '). attr ("ReadOnly", "ReadOnly")//sets the INPUT element to readonly  $ (' input '). Removeattr ("readonly")//Remove the ReadOnly attribute     if ($ (' input ') of the INPUT element. attr ("readonly") ==true)/ Determine if the INPUT element has set the ReadOnly property     There are two:  $ (' input ') for the method to set the ReadOnly property for the element and to cancel the ReadOnly property. 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")//sets the INPUT element to readonly  $ (' input '). attr ("ReadOnly", "")//Remove the ReadOnly attribute of the INPUT element     2.disabled    code is as follows: $ (' input '). attr ("Disabled", "disabled")//set the INPUT element to disabled  $ (' INP UT '). Removeattr ("Disabled")//Remove disabled attribute     if ($ (' input ') of INPUT element. attr ("disabled") ==true)/ Determine if the INPUT element has set the disabled property     The following two kinds of:  code are available for setting the disabled property for an element and canceling the disabled property as follows: $ (' input '). attr (" Disabled ", true)//sets the INPUT element to disabled  $ (' inPut '). attr ("disabled", false)//Remove the disabled attribute of the INPUT element     code as follows: $ (' input '). attr ("Disabled", "disabled")/ Sets the input element to disabled  $ (' input '). attr ("Disabled", "")//Remove the disabled attribute of the INPUT element    

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.