A chain of dynamically created dropdowns using jQuery

I create some undefined filters for the application, and I have this problem when I clone some options.

All this is chosen between them, through the Chained Selects jQuery plugin.

The problem is that every time I clone a selection, the chain stops working, and I tried everything, for example .live (), to make it work, but it seems to me that I’m out of luck: D

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

At first, the chain is selected normally, but when I clone the form, they stop working, except for the first line of the selection.

Thanks!

+1
source share
2 answers

http://jsfiddle.net/FJFFJ/1/ I think this is what you are looking for -)

I realized that when you clone a template, you clone an existing existing template. thus, if you made some choices, and therefore the chain reduced the set of clones you selected with only a reduced set of choices.

I also realized that cloning does not clone a chain.

I also changed the duplication support, so that the binding only applies to newly generated elements.

+2
source

Hmz ... seems a little more complicated ...

Here is another example

+1
source

Source: https://habr.com/ru/post/1433081/


All Articles