Reputation: 5288
Heres what im trying to do. After the form is submitted, i want to disable the submit button until any form element is changed. I already got it almost working using a different question on stackoverflow:
$('#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');
});
One problem is that the if the button is disabled, and the user clicks the button, that counds as a change and its now enabled. So a simple double click of the button re-submits! Any suggestions?
Upvotes: 3
Views: 1606
Reputation: 50976
[type!="submit"]
http://api.jquery.com/attribute-not-equal-selector/
$(':input[type!="submit"]', form.get(0)).live ('change', function (e) {
form.find (':submit').removeAttr ('disabled');
});
Upvotes: 3