Open brockerdock opened 3 years ago
I just figured out the syntax to change the selection state of the multi-select. It would be:
$('#Fruits').val(["0","4"]); $("#Fruits").data("plugin_multiSelect").updateMenuItems();
So that would get the 1st and 5th elemnent of the drop-down "Fruits" selected.
Thanks for this tip; how do you update the label (the concatenated string of options which is show when the select is not open) ? it seems the the updateMenuItems() updates only the content, not the label...
@gregfr .updateButtonContents()
updates the text label inside the button: https://github.com/mysociety/jquery-multi-select/blob/ed762f7582a73702a29208f197a065cfbaff37f0/src/jquery.multi-select.js#L128
It seems that updateButtonContents() does the job
@gregfr
.updateButtonContents()
updates the text label inside the button:
Thanks for the fast answer :-D
Depending on other user input on other parts of a webpage I would like to select/deselect entries in the multi-select. How can I do this?