When the page starts the users is asked to selected a category. Once a category is selected with Ajax some checkboxes are loaded.
I need to do something when these checkboxes are ticked however the problem is i cannot detect change on them since i just added them.
*** options variable contains the input checkbox
$("#subcat").append(options)
I then try to check weither the it is checked or not with the code below
<script>
$(":checkbox").change(function(){
if($(this).attr("checked")) {
alert("abc");
} else {
alert("CBA");
}
});
</script>
If i add a input check box directly onto the html file then it detects change however when i load checkboxes with ajax it does not.
Aucun commentaire:
Enregistrer un commentaire