Open stdedos opened 5 years ago
I am using the example code http://loudev.com/#Searchable almost verbatim.
I have:
function pre_select_options(select_element, pre_select_options) { // // v2: awesome, but not working. multi-select error? // $(`${TC_SELECT_ELEMENT} option`).prop("selected", function () { // return ~$.inArray(this.text, pre_select_options) ? 'selected' : false; // }); $(`${TC_SELECT_ELEMENT} option`).prop("selected", function () { return ~$.inArray(this.text, pre_select_options) ? 'selected' : false; }); } window.onload = function() { pre_select_options($(TC_SELECT_ELEMENT)[0], window.location.hash.slice(1).split(',')); //example-init-code }
and, even though the element on devtools says $0.selected = true, it is not shown on the second list. Only rendering the page with selected="selected" works.
$0.selected = true
selected="selected"
I might be missing the obvious (as I have very limited js experience), but kindly help.
I am using the example code http://loudev.com/#Searchable almost verbatim.
I have:
and, even though the element on devtools says
$0.selected = true
, it is not shown on the second list. Only rendering the page withselected="selected"
works.I might be missing the obvious (as I have very limited js experience), but kindly help.