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 input element readonly attribute
if($('input').attr("readonly")==true)//Determine whether the readonly attribute has been set on the input element
For setting the readonly attribute for the element There are two other ways to cancel the readonly attribute:
$('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 input The readonly attribute of the 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 has the disabled attribute 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