$("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 ; >
// or text1. attr("disabled")==false //Set the first text input box to disabled by setting the value of disabled text1.attr("disabled", "disabled"); } else { //Clear the disabled attribute in the first text input box by overwriting text1.attr("disabled", ""); } }); $("button:eq(1)").click(function () { var text2 = $("input:text:eq(1)"); if (text2.attr("disabled ") == false) { //Set the second text input box to disabled by setting the value of disabled text2.attr("disabled", "disabled"); } else { //Delete the disable attribute of the second text input box by removing it text2.removeAttr("disabled"); } }); $("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 disabled boolean attribute text2.attr("disabled", true); } else { //Pass Set the disabled attribute of the third text input box to false to remove the disabled attribute text2.attr("disabled", false); } }); }); // -->
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn