JQuery: How to clone autocomplete fields?

前端 未结 2 1195
难免孤独
难免孤独 2021-01-21 06:19

I am using Jörn Zaefferer\'s jquery autocomplete plugin, and I can\'t seem to figure out how to make it work when I clone an autocomplete field. It almost works, in that the clo

相关标签:
2条回答
  • 2021-01-21 07:20

    Make

    $newParticipant = $("#template").clone(true);
    

    like so

    $newParticipant = $("#template").clone();
    

    Your example works for me in FF when you don't clone events on #template.

    0 讨论(0)
  • 2021-01-21 07:24

    first of all:

    $newParticipant.children("div").children(":input").length == 0
    

    so there is no children returned by this line. Use

    $newParticipant.children()
    

    instead. It returns 1 chield instead. But steel don't work for me. Have to think more.

    0 讨论(0)
提交回复
热议问题