Skip to content Skip to sidebar Skip to footer

JQuery Clone() Copies Data...sometimes...?

Using the sample below, I have a tr that I am duplicating. It contains a jQuery autocomplete. The first time it is cloned, the auto complete functionality does not work because the

Solution 1:

There were multiple issues I had to fix to get this to work.

First was pointed out by @pimvdb - I wasn't IDing the elements correctly so the second new row had the same ID as the template row.

Second, you can't simply call autocomplete on a widget that is already an autocomplete - first you have to destroy it:

textbox.autocomplete("destroy");
textbox.removeData("autocomplete");

The 12th revision works correctly: http://jsfiddle.net/SDvF4/12/


Post a Comment for "JQuery Clone() Copies Data...sometimes...?"