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