How to enable the submit button when I check atleast 1 checkbox?
$("input[name='vehicle']"), submitButt = $("input[name='finalpay']");
var checkboxes = $("input[name='vehicle']"),
submitButtList = $("#Submit");
checkboxes.click(function() {
submitButt.attr("disabled", !checkboxes.is(":checked"));
if (!checkboxes.is(":checked")) {
submitButtList.addClass("disabled");
} else {
submitButtList.removeClass("disabled");
}
});
<script src="http://ift.tt/1eH01Db"></script>
<input type="checkbox" name="vehicle" value="Bike"> I have a bike<br>
<input type="checkbox" name="vehicle" value="Car"> I have a car<br>
<input type="submit" value="Submit" disabled>
Aucun commentaire:
Enregistrer un commentaire