Search code examples
jqueryclone

jQuery cloned objects not being picked up


I have two tables and each row within both tables have a <td> with a checkbox. Currently, when something is checked on the second table, it copies that row (using .clone()). When a row in the first table is unchecked, it should be removed from the first table.

This works perfectly fine for rows that were in the first table upon page generation. But the cloned rows do not fire off the jQuery and I was wondering what approach I should take to fix this.

Here is the jsfiddle: http://jsfiddle.net/3BZp4/21/


Solution

  • Pass true as the first argument of .clone to ensure that events already registered on those elements get copied too.

    See http://jsfiddle.net/alnitak/Kr248/