jquery - Semantic UI: Multi Select Dropdown pre-select values -
i'm working on building web page using semantic ui framework. i'm new both ui frameworks , jquery. i'm using multi select dropdown component select roles user. i'm able implement dropdown , select values.
but can me set default value(pre-selected) dropdown ? i've tried behaviors specified here , somehow can't work. there i'm missing here ?
here fiddle , code.
my html:
<div class="twelve wide field"> <label style="width: 250px">add roles user</label> <select name="skills" multiple="" class="ui fluid dropdown"> <option value="">roles</option> <option value="role1">role 1</option> <option value="role2">role 2</option> <option value="role3">role 3</option> </select> </div>
my javascript:
$(".ui.fluid.dropdown").dropdown({ allowlabels:true}) $('.ui.fluid.dropdown').dropdown({'set selected': 'role1,role2'});
also, can in fetching values variable in javascript?
your syntax off. try this:
$('.ui.fluid.dropdown').dropdown('set selected',['role1','role2']);
Comments
Post a Comment