Jquery's API provides methods for applying disabled and readonly attributes to elements, which are recorded here. As follows:
1.readonly
$('input ').attr("readonly","readonly")//Set the input element to readonly
$('input').removeAttr("readonly");//Remove the readonly attribute of the input element
if($('input').attr("readonly")==true)//Determine whether the input element has the readonly attribute set
Methods for setting the readonly attribute and canceling the readonly attribute for the element There are also the following two types:
$('input').attr("readonly",true)//Set the input element to readonly
$('input').attr("readonly",false) //Remove the readonly attribute of the input element
$('input').attr("readonly", "readonly") // Set the input element to readonly
$('input').attr ("readonly","")//Remove the readonly attribute of the input element
2.disabled
$('input').attr("disabled","disabled")//Set the input element to disabled
$(' input').removeAttr("disabled");//Remove the disabled attribute of the input element
if($('input').attr("disabled")==true)//Determine whether the input element is The disabled attribute has been set
There are two other ways to set the disabled attribute and cancel the disabled attribute for an element:
$('input').attr("disabled",true)//Set the input element to disabled
$('input ').attr("disabled",false)//Remove the disabled attribute of the input element
$('input').attr("disabled","disabled")//Set the input element to disabled
$('input').attr( "disabled","")//Remove the disabled attribute of the input element