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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -