I am using the following js code to disable the form submit button until at least one checkbox selection is checked.
var checkboxes = $("input[type='checkbox']"),
submitButt = $("input[type='submit']");
checkboxes.click(function() {
submitButt.attr("disabled", !checkboxes.is(":checked"));
});
The problem is the code doesn't work when the page first loads. When the user first comes to the page, he is able to click submit but if he checks something and then unchecks everything the submit is then disabled.
It looks like I need the code to start when the page first loads. Any suggestions?
Aucun commentaire:
Enregistrer un commentaire