have a multi - select field
using browser dev tools see it's handled by chosen ( https://harvesthq.github.io/chosen/ ) multi-select plugin
have no issues working with normal selects via jquery for setting , adding, removing options, etc... ( see below example )
$('select[id^="valueREGION"]').find('option').remove();
$('select[id^="valueREGION"]').prepend('<option value = "">Please Select</option>');
if (numregions > 0) {
for (i = 0; i < numregions; i++) {
region = regionsarray[i];
region = region.trim();
$('select[id^="valueREGION"]').append($('<option>', {
value: region,
text: region
}));
if (i == 0) {
firstreg = region;
}
}
}
but for multi-select selects... hum... and since being handled by chosen multi-select plugin
not getting very far
reviewed the chosen documentation in the above url... but not much help...
anyways here's what see via dev tools in Edge for multi select field
(screen snap shot)
https://www.screencast.com/t/zpkpOjttBwO
( dev tool outer html )
<span id="edit1_ACCESSES_0" class="bs-ctrlspan rnr-nowrap "><input id="type_ACCESSES_1" type="hidden" name="type_ACCESSES_1" value="multiselect"><select id="value_ACCESSES_1" size="1" name="value_ACCESSES_1[]" multiple="" class="form-control" style="display: none;"></select><div class="chosen-container chosen-container-multi" title="" id="value_ACCESSES_1_chosen" style="width: 100%; position: static;"><ul class="chosen-choices">
<li class="search-field">
<input class="chosen-search-input default" type="text" autocomplete="off" value="Please select" style="width: 93px;">
</li>
</ul>
<div class="chosen-drop" style="width: 555px; top: 34px; left: 15px; display: none;">
<ul class="chosen-results"></ul>
</div></div></span>
I've tried doing following to set no results / options per doc
$(".chosen-select").chosen({no_results_text: "Oops, nothing found!"});
where my best guess for the element would be
$(". edit1_ACCESSES_0").chosen({no_results_text: "No Accesses"});
Any suggestions / thoughts on how to set a multi-select option most appreciated.
Thanks
Mark