Skip to main content
added 2 characters in body
Source Link
RGS
  • 5.2k
  • 7
  • 44
  • 69
$(function(){
    $("#txtres").attr("disabled", "disabled");
    $("#txtres2").attr("disabled", "disabled"); 
    $("#chknew").click(function () {    
        $("#txtres").attr("disabled", !this.checked);
        $("#txtres2").attr("disabled", !this.checked);          
    });
});

Demo:

http://jsfiddle.net/w2jtg1b9/1/http://jsfiddle.net/w2jtg1b9/3/

$(function(){
    $("#txtres").attr("disabled", "disabled");
    $("#txtres2").attr("disabled", "disabled"); 
    $("#chknew").click(function () {    
        $("#txtres").attr("disabled", this.checked);
        $("#txtres2").attr("disabled", this.checked);          
    });
});

Demo:

http://jsfiddle.net/w2jtg1b9/1/

$(function(){
    $("#txtres").attr("disabled", "disabled");
    $("#txtres2").attr("disabled", "disabled"); 
    $("#chknew").click(function () {    
        $("#txtres").attr("disabled", !this.checked);
        $("#txtres2").attr("disabled", !this.checked);          
    });
});

Demo:

http://jsfiddle.net/w2jtg1b9/3/

added 51 characters in body
Source Link
RGS
  • 5.2k
  • 7
  • 44
  • 69
$(function(){
    $("#txtres").attr("disabled", "disabled");
    $("#txtres2").attr("disabled", "disabled"); 
    $("#chknew").click(function () {    
        $("#txtres").attr("disabled", this.checked);
        $("#txtres2").attr("disabled", this.checked);          
    });
});

Demo:

http://jsfiddle.net/w2jtg1b9/1/

$(function(){
    $("#txtres").attr("disabled", "disabled");
    $("#txtres2").attr("disabled", "disabled"); 
    $("#chknew").click(function () {    
        $("#txtres").attr("disabled", this.checked);
        $("#txtres2").attr("disabled", this.checked);          
    });
});
$(function(){
    $("#txtres").attr("disabled", "disabled");
    $("#txtres2").attr("disabled", "disabled"); 
    $("#chknew").click(function () {    
        $("#txtres").attr("disabled", this.checked);
        $("#txtres2").attr("disabled", this.checked);          
    });
});

Demo:

http://jsfiddle.net/w2jtg1b9/1/

Source Link
RGS
  • 5.2k
  • 7
  • 44
  • 69

$(function(){
    $("#txtres").attr("disabled", "disabled");
    $("#txtres2").attr("disabled", "disabled"); 
    $("#chknew").click(function () {    
        $("#txtres").attr("disabled", this.checked);
        $("#txtres2").attr("disabled", this.checked);          
    });
});