How to use?
Add the following library Select2 stylesheet and script in your page.
Copy-paste the stylesheet <link>
into your <head>
to load the CSS.
Copy-paste the following <script>
near the end of your pages under JS Implementing Plugins to enable it.
Copy-paste the following <script>
near the end of your pages under JS Front to enable it.
Copy-paste the init function under JS Plugins Init., before the closing </body>
tag, to enable it.
Methods
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-hs-select2-options='{}'
. For more detailed or missing attributes/functions, see the official Select2 documentation page.
Parameters | Description | Default value |
---|---|---|
|
Class for select field | custom-select |
|
Width of input | 100% |
|
Placeholder for serach input inside container | false |
|
Placeholder for serach input inside container | false |
|
Text neasted input with tags for multiple select | false |