chosen add multiple row dinamical
Posted
by
Mario Jose Mixco
on Stack Overflow
See other posts from Stack Overflow
or by Mario Jose Mixco
Published on 2012-10-30T04:44:58Z
Indexed on
2012/10/30
5:00 UTC
Read the original article
Hit count: 196
I have a question with the plugin ajax-chosen, I need to add multiple dynamically
on a form on page load the first no problem but when I try to dynamically add a
new element does not work, I hope you can help me and again sorry for my English
$ ("a.add-nested-field"). each (function (index, element) {
return $ (element). on ("click", function () {
var association, new_id, regexp, template;
association = $ (element). attr ("data-association");
template = $ ("#" + association + "_fields_template"). html ();
regexp = new RegExp ("new_" + association, "g");
new_id = new Date (). getTime ();
$ (element). closest ("form"). FIND (". nested-field: visible: last"). after (template.replace (regexp, new_id));
return false;
});
});
© Stack Overflow or respective owner