jquery cloning a block of element. select element acting weired

前端 未结 2 1954
忘掉有多难
忘掉有多难 2020-12-21 12:30

Here is the recreation of my problem http://jsfiddle.net/WsFyV/7/ Select any option from the first one. and then click on add. The select element is cloned but with the valu

相关标签:
2条回答
  • 2020-12-21 12:58

    The problem is uniform. It's unable to handle the cloning, and among other things creates duplicate ids, which is why the original select always gets focus when you select something in the clone.

    0 讨论(0)
  • 2020-12-21 13:04

    We've got exactly same problem here but just using $.uniform.update("selector") or $('selector').uniform() didn't worked for us on cloned elements.

    What we've done to get it work was to replace the closest .selector by the select itself and then unforming it again:

    // clonedObject is a jQuery object containing our cloned select
    clonedObject.closest('.selector').replaceWith(clonedObject);
    clonedObject.uniform();
    

    Hope this will save someone else a little time

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