JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://rawgithub.com/brianreavis/selectize.js/master/dist/js/standalone/selectize.js"></script>
<link rel="stylesheet" href="https://rawgithub.com/brianreavis/selectize.js/master/dist/css/selectize.default.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<div style="padding:20px;">
<select>
<option value="1" data-html="
<img src='https://cdn1.iconfinder.com/data/icons/logotypes/32/chrome-32.png'> Google Chrome">Google Chrome</option>
<option value="2" data-html="
<img src='https://cdn0.iconfinder.com/data/icons/flat-round-system/512/firefox-32.png'> Mozilla Firefox">Mozilla Firefox</option>
<option value="3" data-html="
<img src='https://cdn0.iconfinder.com/data/icons/flat-round-system/512/internet_explorer-32.png'> Internet Explorer">Internet Explorer</option>
</select>
</div>
JavaScript
$('select').selectize({
onInitialize: function () {
var s = this;
this.revertSettings.$children.each(function () {
$.extend(s.options[this.value], $(this).data());
});
},
render: {
option: function (item, escape) {
return '<div>' + item.html + '</div>';
},
item: function (item, escape) {
// first item is rendered before initialization
// is it a bug?
if (!item.html) {
$.extend(item,
$(this.revertSettings.$children)
.filter('[value=' + item.value + ']').data()
);
}
return '<div class="item">' + item.html + '</div>';
}
}
});