Created
February 19, 2013 18:15
-
-
Save fgrehm/4988391 to your computer and use it in GitHub Desktop.
Cocoon + Chosen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery ($) -> | |
$('.add_fields').each -> | |
$this = $(this) | |
insertionNode = $this.data('association-insertion-node') | |
insertionTraversal = $this.data('association-insertion-traversal') | |
if (insertionNode) | |
if (insertionTraversal) | |
insertionNode = $this[insertionTraversal](insertionNode) | |
else | |
insertionNode = insertionNode == "this" ? $this : $(insertionNode) | |
else | |
insertionNode = $this.parent() | |
insertionNode.bind 'cocoon:after-insert', (e, newContent) -> | |
newContent.find('.chzn-select').chosen() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you so much Man :D it saved the day for me.