Autocomplete - using autocomplete on dynamically added form element

Autocomplete - using autocomplete on dynamically added form element

Hi,

I'm using the tutorial here

http://www.dustindiaz.com/add-remove-elements-reprise/

To dynamically add extra elements to a form. When I do this, autocomplete only works on the original form elements.

I tried calling:

           var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
           $("#foo").autocomplete(data);

after adding my new input with id='foo' but that still doesn't work.

I notice that when I view the id's in FIrefox using the web developer toolbar, the original input has class '.ac_input' - clearly that's being added by jquery somewhere. This doesn't appear on my newly created elements, so I'm guessing is part of my problem.

Can anyone suggest what I need to do when adding my extra input field to make autocomplete work on my new input fields?

Many thanks!