I have a nested form using Cocoon. Within the nested form I have a select menu that I want to call chosen() on.
Normally I would have the following in the code
$('#cust_select').chosen()
However, I need to call this after a nested field has been added using something such as
$('#container').bind('cocoon:before-insert', function(e, inserted_item) {
// ... do something
});
However, I can’t get this to work and so have 2 questions
- what is the coffee script version of this code?
- is inserted_item the actual code to use or should item be replaced with the model name?
any thoughts?
Michael
1) The CoffeeScript version is:
2) inserted_item is indeed the inserted item:
From here