[ad_1]
In Semantic-UI dropdown single i can preselect a value both on a select or with the matching HTML and a hidden input:
https://jsfiddle.net/2Acode/yus38pa0/
<div class="ui fluid search selection dropdown">
<input type="hidden" name="country" value="al">
<i class="dropdown icon"></i>
<div class="default text">Select Country</div>
<div class="menu">
<div class="item" data-value="af"><i class="af flag"></i>Afghanistan</div>
<div class="item" data-value="ax"><i class="ax flag"></i>Aland Islands</div>
<div class="item" data-value="al"><i class="al flag"></i>Albania</div>
<div class="item" data-value="dz"><i class="dz flag"></i>Algeria</div>
</div>
</div>
<select class="ui fluid search dropdown">
<option value="">State</option>
<option value="AL">Alabama</option>
<option value="AK" selected>Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
</select>
But in multiple version doesn't work:
https://jsfiddle.net/2Acode/mb1kxujw/
<div class="ui fluid multiple search selection dropdown">
<input type="hidden" name="country[]" value="al">
<i class="dropdown icon"></i>
<div class="default text">Select Country</div>
<div class="menu">
<div class="item" data-value="af"><i class="af flag"></i>Afghanistan</div>
<div class="item" data-value="ax"><i class="ax flag"></i>Aland Islands</div>
<div class="item" data-value="al"><i class="al flag"></i>Albania</div>
<div class="item" data-value="dz"><i class="dz flag"></i>Algeria</div>
</div>
</div>
<select name="country[]" class="ui fluid search dropdown" multiple="">
<option value="">State</option>
<option value="AL">Alabama</option>
<option value="AK" selected>Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
</select>
There is a way, in the multiple version, to preselect from html code directly (without using javascript)?
Thanks
[ad_2]
لینک منبع