I have a few checkboxes and a submit button that is initially disabled. When checking the box, the button is turned on, and when you uncheck the box, the button is turned off again.
If several checkboxes are selected, but uncheck the button, the button will become inaccessible, even if I selected other checkboxes. How can I fix this problem?
<script type="text/javascript"> $(function() { $(".checkbox").click(function() { $(".delete").attr("disabled", !this.checked); }); }); </script>
HTML
<input type="checkbox" name="msg[]" value="32" class="checkbox" /> <input type="checkbox" name="msg[]" value="44" class="checkbox" /> <input type="checkbox" name="msg[]" value="26" class="checkbox" /> <button type="submit" class="delete" disabled="disabled">Delete</button>
source share