Reputation: 71188
I need to disable the disable the submit button on my form and to enable if the onchange event occurs for any other input on the form
so basically I need to:
anybody knows how to do this ? (especially the second one)
Upvotes: 1
Views: 4263
Reputation: 655139
Try this:
$("form").submit(function() {
$(this).find(":submit").attr("disabled", "disabled");
}).find(":input").change(function() {
$(this).parent("form").find(":submit").removeAttr("disabled");
});
Upvotes: 1
Reputation: 5849
Using jQuery 1.4:
// To disable submit button
$('#myform').find (':submit').attr ('disabled', 'disabled');
// Re-enable submit
var form = $('#myform');
$(':input', form.get(0)).live ('change', function (e) {
form.find (':submit').removeAttr ('disabled');
});
Upvotes: 2
Reputation: 4871
Something like this:
$("#myform").children().change(function(){
$("#submit").removeAttr('disabled');
});
Upvotes: 0