Semantic UI: Multi Select Dropdown pre-select values
Add values ( <option selected="selected">
) dropdown semantic about all select :
$("select").each(function(){
var $that = $(this);
var values = $that.val();
$("option", $that).each(function(){
$(this).removeAttr("selected");
});
$that.dropdown('set selected', values);
$("option", $that).each(function(){
var curr_value = $(this).val();
for(var i = 0; i < values; i++){
if(values[i] == curr_value){
$(this).attr('selected','selected');
}
}
});
});
Your syntax is slightly off. Try this:
$('.ui.fluid.dropdown').dropdown('set selected',['Role1','Role2']);