Hi, i'm trying to clone a row in a table with events attached to it.
I initialy have the following html code to duplicate : <tr> <td> <input type="text" id="users" name="users[]" class="users" /> </td> <td> <input type="text" id="expiration" name="expiration[]" class="expirationDate" /> <a class="addUser">+</a> </td> </tr> On the "users" input i have the autocomplete plugin and on "expirationDate" the datepicker one. When i started cloning, i had the html code alright but not the events. So i surrounded the original functions with this : $ (".users").live("click",function(){ ending up with this : $(".users").live("click",function(){ $(".users").autocomplete('/contactSearch.html', { width: 300, multiple: true }); }); $(".expirationDate").live("click",function(){ $(".expirationDate").datepicker({ dateFormat: 'dd/mm/yy' }); }); Despite the fact that it doesn't sound optimized, this work with the autocomplete plugin but no so well with datepicker. My question really is : there must be a better way, isn't there? I just need to clone the element with the javascript exactly has it is when loaded. Thanks!