使用JQuery链动态创建下拉菜单 [英] Chain dynamically created dropdowns with JQuery

查看:101
本文介绍了使用JQuery链动态创建下拉菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为应用程序构建了一些不确定的过滤器,当克隆一些选择时,我遇到了这个问题。

I'm building some kind of indefinite filters for an app, and I'm havin this problem when I clone some selects.

事情是这样选择的链接在它们之间,通过 Chained Selects jQuery插件。

The things is this selects are chained between them, trough the Chained Selects jQuery plugin.

问题是,我每次克隆这些选择时,链接都停止工作,并且我尝试了一切,例如.live()使其工作,但似乎我出局了的运气:D

The problem is that every time I clone the selects, the chaining stops working, and I've tryed everything, such as .live() to make it work, but it seems I'm out of luck :D

这里有一个我正在谈论的样本, http://jsfiddle.net/7K2Eu/63/

Here you have a sample of what I'm talking about, http://jsfiddle.net/7K2Eu/63/

起初,选择链正常,但是当我克隆表格,他们停止工作,除了第一行选择。

At first, the selects chain normally, but when I clone the form, they stop working, except for the first row of selects.

谢谢!!

Thank you!!

推荐答案

http://jsfiddle.net/FJFFJ/1/ 我认为这就是你搜索; - )

http://jsfiddle.net/FJFFJ/1/ i think this is what you search ;-)

我发现当你做模板的克隆时,你只克隆当前的模板。因此如果你做出了一些选择,并且因此链接减少了选择集合,那么你只克隆那些缩减的选择集合。

I figured out that when you do the clone of the template you only clone the current existing template. thus if you made some choices and therefore the chaining reduced the set of selections you clone only that reduced set of selections.

我还发现克隆不克隆链接。

I also figured out that cloning doesn't clone the chaining.

另外,我更改了您的复制支持,以便链接仅应用于新生成的项目。

Also I changed your duplication support so that the chaining only is being applied to the new generated items.

这篇关于使用JQuery链动态创建下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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