so i want to disable the input button function unless checkbox is checked. I want not a specific one checkbox but IF a checkbox or multiple checkboxes are checked the button, which is a delete button, will be enabled. the issue im having is that the delete button is only enabled when the first checkbox is checked. say for example the second or third checkbox were checked the delete button is still disabled unless the first checkbox is checked as well.
is there a way around this?
the button :
<input type="submit" id="del_event" name="del_event" value="Delete Event"/>
the checkbox is echoed this is the coding:
echo
"<tr>
<td><input type='checkbox' name='check' id='check'/><a href='' class='event-link'>$name</a>
</td><td>$date</td><td>$time</td><td>$venue</td>
</tr>";
the script im using is:
var chkbox = $("#check"),
button = $("#del_event");
button.attr("disabled","disabled");
chkbox.change(function(){
if(this.checked){
button.removeAttr("disabled");
}else{
button.attr("disabled","disabled");
}
});
any help is appreciated.
#checkas an identifier is your main problem - anidis supposed to be completely unique: on only 1 element in a page.