I have two checkboxes. each one have a sub form that is disable when the checkbox isn’t marked. i want on marking each checkbox its sub form get enabled.
I try this code but this works even the checkbox is not checked:
$("#form1").click(function(){
if(":checked",this) { ..... }
});
$("#form2").click(function(){
if(":checked",this) { ..... }
});
would you help me?
You can use the jQuery
ismethod:What you have currently will always evaluate to true, because
thiswill always be something truthy (notundefinedornullfor example).Note that you need to pass
thisinto jQuery because it will be a reference to the clicked DOM element itself, not a jQuery-wrapped element.