Jquery: Handling Checkbox Click Event with JQuery
Posted
by wcolbert
on Stack Overflow
See other posts from Stack Overflow
or by wcolbert
Published on 2010-04-15T05:40:22Z
Indexed on
2010/04/15
5:43 UTC
Read the original article
Hit count: 264
jquery-selectors
|jQuery
I can't figure out what is going on here. I have some nested lists of checkboxes that I would like to check when the parent is checked. More importantly, I can't even get the alert to show up. It's as if the click event is not firing. Any ideas?
$(document).ready(function() {
$("#part_mapper_list input[type=checkbox]").click(function(){
alert("clicked");
if ($(this).attr("checked") == "checked"){
$(this + " input").attr("checked") = "checked";
} else {
$(this + " input").attr("checked") = "";
}
});
}
© Stack Overflow or respective owner