Autocomplete to new appended items..

Autocomplete to new appended items..

Hello..

I want make autocomplete work with any new appended items in my page. f.e. here is my code:

  1. $(document).ready(function(){
  2. $(".insert").live("click", function(){
  3. $("tr:has(.insert)").append("<td><input type='text' name='product_id' id='product_id' /></td>");
  4. $("#product_id").autocomplete("getValues.jsp",{
    extraParams: {action:"getProducts"}
    });


  5. $(this).attr("class", "remove");
  6. $(this).text("Remove");
  7. $(".pricing_tbl").append("<tr><td class='insert'>Add</td></tr>");
  8. });
  9. $(".remove").live("click", function(){
  10. $(this).attr("class", "mark_rm");
  11. $("tr:has(.mark_rm)").fadeOut("1500", function(){
  12. $(this).remove();
  13. });
  14. });
  15. });
So, my problem is that when the new <td> is added, autocomplete is not assigned to it. Is there any way, like the "live" function, to keep autocomplete assigned to all the elements that is,or will be, in the document?

Thanks in advance.