jQuery克隆一个元素块.选择奇怪的元素 [英] jquery cloning a block of element. select element acting weired

查看:70
本文介绍了jQuery克隆一个元素块.选择奇怪的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题的重现 http://jsfiddle.net/WsFyV/7/ 从第一个选择任何选项.然后单击添加. 选择元素被克隆,但在第一个元素中具有选择的值, 我的主要问题是您无法在新的select元素中选择任何其他选项. 我在做错什么吗?

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?

我知道了.

$.uniform.update("select");

成功了. http://jsfiddle.net/broncha/WsFyV/34/修复了select元素变更事件 :)谢谢大家

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

推荐答案

问题是统一的.它无法处理克隆,并且会创建重复的ID,这就是为什么当您在克隆中选择某些内容时原始选择始终会获得焦点的原因.

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.

这篇关于jQuery克隆一个元素块.选择奇怪的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆