I am using Selectize.js.
On page load when inspecting the elements in Selectized drop-down the the actual content is missing (inside .selectize-dropdown-content):
<div class="selectize-dropdown single aritklmodel" style="display: none;">
<div class="selectize-dropdown-content"></div>
</div>
After the click it populates the content:
<div class="selectize-dropdown single aritklmodel" style="display: none; visibility: visible; width: 255.617px; top: 34px; left: 0px;">
<div class="selectize-dropdown-content">
<div style="display: block" data-marka="2" data-selectable="" data-value="a2" class="">a2</div>
<div style="display: block" data-marka="1" data-selectable="" data-value="A50">A50</div>
</div>
</div>
Is there a way to populate it on page load?
Because as seen from above I use custom data attributes with whom I filter the options based on previous Selectized drop-down selection.
Current problem is that when i make selection in first drop-down the filter is not working as it has nothing to filter, as content is not in DOM, just after i click once on second drop-down and content populates in DOM the filtering starts working after changes on first one.
I tried triggering/simulating the click event, its not working.
I have read API and usage documentation, if I missed answer, I didn't understand it (not a native english speaker)
$('select').selectize({
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/css/selectize.bootstrap3.min.css" integrity="sha256-ze/OEYGcFbPRmvCnrSeKbRTtjG4vGLHXgOqsyLFTRjg=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/js/standalone/selectize.min.js" integrity="sha256-+C0A5Ilqmu4QcSPxrlGpaZxJ04VjsRjKu+G82kl5UJk=" crossorigin="anonymous"></script>
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
EDIT:
Is there a way to programmatically de-selectize the HTML select, so I can do filtering on HTML select itself, and then selectize it again?
Is there any way of doing filtering of one selectized drop-down based on another? Using data attribute or any other?