I have a form with a few textareas and selectors and the submit button which is disabled be default. I need to remove “disabled” attribute when each textarea has has at least something in them.
Tried this, but it does not seem to work:
$("#mySubmit").parent().find("textarea").change(function(){
if ($(this).val() != "") {
$("#mySubmit").removeAttr("disabled");
} else {
$("#mySubmit").attr("disabled");
}
});
What am I missing?
Try this
.prop()reference: http://api.jquery.com/prop/ jQuery Ver 1.6+If you are using older version then use
attr/removeAttrinstead ofprop.