Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Cocoon + Chosen
jQuery ($) ->
$('.add_fields').each ->
$this = $(this)
insertionNode = $'association-insertion-node')
insertionTraversal = $'association-insertion-traversal')
if (insertionNode)
if (insertionTraversal)
insertionNode = $this[insertionTraversal](insertionNode)
insertionNode = insertionNode == "this" ? $this : $(insertionNode)
insertionNode = $this.parent()
insertionNode.bind 'cocoon:after-insert', (e, newContent) ->

This comment has been minimized.

Copy link

@kaoussi kaoussi commented Jul 30, 2017

Thank you so much Man :D it saved the day for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.