The Better-Nice-Select plugin displays data in a modern format, via data attributes or JavaScript.
Options
As options can be passed via data attributes or JavaScript, you can append an option name to data-, as in data-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-custom-search="searcher" instead of data-customSearch="searcher".
Via data attributes
For pre-selecting options you can use selected="selected" or for multiple select, you can use multiple="multiple" or just multiple.
You can even use <optgroup> tags to render options in a group and search for group texts in the items search overlay field.
The <select> data is now supported for remote URL data through the initialization with a data attribute or via JavaScript.
Via JavaScript
Call a better-nice-select field with an id or class.
For setting available options, create a javascript object and append it to the initialization. You can set something like the locale option, the scrollable feature or many more.
For using remote URL data, give the option customSearch the function name you created or a callback function and return the data in JSON format. When using remote URL data, predefined options
which are not already selected="selected" are ignored but the select field need to be HTML conform, if your JSON data is using <optgroup> tags or other available data options.