Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
556 views
in Technique[技术] by (71.8m points)

jquery cloning a block of element. select element acting weired

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 value selected in the first one, My main problem is you cant select any other option in the new select element. Am I doing something wrong?

I got the fix.

$.uniform.update("select");

did the trick. http://jsfiddle.net/broncha/WsFyV/34/ theres the fix on select element onchange event :) thanks guys

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...