jquery dynamically added checkbox not working with change() function

Posted by estern on Stack Overflow See other posts from Stack Overflow or by estern
Published on 2011-01-14T14:49:38Z Indexed on 2011/01/14 14:53 UTC
Read the original article Hit count: 144

Filed under:
|
|
|

I dynamically load in a few li's that have a label and a checkbox in them to another visible ul. I set the checkboxes to be checked="checked" and i am trying to trigger an event to happen when i change these dynamically inserted checkboxes but nothing occurs.

Here is the jquery:

$(".otherProductCheckbox:checkbox").change( function(){
    alert('test');
});

Here is the html for the dynamically added li's:

<li class="otherProduct"><input type="checkbox" class="otherProductCheckbox radioCheck" checked="checked"/><label>Product Name</label></li>

Any idea why i cant get the alert to happen when the checkbox changes its checked state?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about dynamic