Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.6k 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...