Select2 - hide/show optgoup based on another selection?

56 views
Skip to first unread message

j inch

unread,
Nov 30, 2016, 8:22:51 PM11/30/16
to select2
I am trying to get two select2 dropdowns to respond to each other based on state /country selection.

i.e. if United States is selected show only the "optgroup" for the states in the other drop down / if Canada is selected - only show provinces / if any other is selected disable and remove required attribute.

So far I found this code that I am trying to implement in my select2 setup but unfortunately I am having no luck.

It seams to not recognize the hide/show script for the select2 "optgroup"? This work if not using a select2 setup so not sure how I can work around.

Any advise is welcome.

Demo on jsfiddle


Reply all
Reply to author
Forward
0 new messages