How to disable the select2 style for select boxes?


#1

I just started integration of select2 in our platform. It’s basically a custom made java web application, where we heavily do use select boxes. We already do have our own style for the whole form. Is it possible to make select2 not to override the current select boxes styles? I just want it to have the current functionality without applying its style sheet. Could you help me pls?


#2

Since the Select2 widget is created out of HTML div, span and other elements, they must have some CSS styling to make them appear like a combobox. However, according to the documentation you can create your own theme to style the Select2 widget however you want. Unfortunately the documentation doesn’t really provide instructions on how to do this. I would recommend you look at the theme styles in the Select2 CSS and copy them into your own CSS (renaming them to your own theme name, of course). Then you can specify your theme name when you initialize your Select2 widget. You could also copy this Bootstrap theme and alter it to match your site’s design.