I am using selectize.js for my project. But I have problems with data-attributes. I want to add data-attributes to the select options. I have default select like this:
<option data-open-balance="false" selected="selected" value="1">PNP.SI.080416</option>
But When I add selectize to this select, it becomes:
<div data-value="1" data-selectable="" class="selected">PNP.SI.080416</div>
I see that its "item object" only get value, and text. So, how can I add other data-attributes to its item object?
<option data-data='<?php echo json_encode( $your_option ); ?>' value='<?php echo $value; ?>'><?php echo $text; ?></option>
. It's very important the use of single quote ' in data-data tag, because JSON use double quote " for the structure. – Libertinism