Closed hamyo closed 7 years ago
Good day. When I call trigger("chosen: updated") in a script, the selected value is displayed without an image.
<select id="example" class="img-select"> <option data-img-src="images/1.png" value="1">1</option> <option data-img-src="images/2.png" value="2">2</option> <option data-img-src="images/3.png" value="3">3</option> <option data-img-src="images/4.png" value="4">4</option> </select> <script type="text/javascript"> $(document).ready(function () { let $example = $("#example"); $example.chosen({disable_search: true}); $example.find("option").first().hide(); $example.find("option[value=3]").prop('selected', true); $example.trigger("chosen:updated"); }); </script>
Should work now :)
Good day. When I call trigger("chosen: updated") in a script, the selected value is displayed without an image.