The first one: change the boolean status of disabled, the specific code and explanation are as follows:
The code is as follows:
$("button:eq(2)").click(function(){
var text2=$("input:text:eq(2 )");
if(text2.attr("disabled")==false){
//Set the disabled attribute of the third text input box to true by setting the boolean attribute of disabled
text2. attr("disabled",true);
}else{
//Remove the disabled attribute by setting the disabled attribute of the third text input box to false
text2.attr("disabled",false ; >
Copy code
The code is as follows:
text2.removeAttr("disabled");
}
});
The third method: change the value of disabled, the specific code and explanation are as follows:
The code is as follows:
Copy code
The code is as follows:
//Clear the disabled attribute in the first text input box by overwriting
text1.attr("disabled","");
}
});
The complete sample code is as follows (tested and passed):
The code is as follows:
Copy Code
The code is as follows: