Can you dynamically remove and re-add the select2 binding

133 views
Skip to first unread message

jeff.t...@gmail.com

unread,
Aug 6, 2015, 6:57:16 PM8/6/15
to select2
Hey... this is an odd question, and I don't quite know how to ask it.

I have this modal form that if the user closes, I want to reset. The select2 fields are generated dynamically. The issue I'm having is that once I reset most of the inputs, I can't un-call the .select2 method. Is there a way to remove the .select2 bind and then rebind later?

jeff.t...@gmail.com

unread,
Aug 6, 2015, 7:17:39 PM8/6/15
to select2, jeff.t...@gmail.com
On Thursday, August 6, 2015 at 6:57:16 PM UTC-4, jeff.t...@gmail.com wrote:
> Hey... this is an odd question, and I don't quite know how to ask it.
>
> I have this modal form that if the user closes, I want to reset. The select2 fields are generated dynamically. The issue I'm having is that once I reset most of the inputs, I can't un-call the .select2 method. Is there a way to remove the .select2 bind and then rebind later?

Nevermind... I think I figured it out... I cloned an element to have as a template for when I reset, but my select2 jquery selector is grabbing that one (even though it is not attached to the document).

Reply all
Reply to author
Forward
0 new messages