You can use the addChoice
method provided by Choices.js to programmatically add options to the select menu. Here's an example:
const choices = new Choices('#my-select');
choices.addChoice({
value: 'option-value',
label: 'Option Label',
selected: true
});
In this example, the addChoice
method adds a new option to the select menu with the value "option-value", label "Option Label", and the selected
property set to true
. This will ensure that the option remains selected even if the user clicks away from the menu and comes back later.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-01-05 11:00:00 +0000
Seen: 10 times
Last updated: Aug 25 '22
How can I include a right-click action for the navigation menu in Angular?
What is the reason for the menu bar not being enabled when using activate(ignoringOtherApps:)?
Is it not possible to clone a repository using Git on PyCharm?
What is the method to show previously selected options from a dropdown menu?
After completion, how can one remove a Menu Item from unity?
How can I create dynamic menu options for a custom TinyMCE button?
What are the sizes of OS X icons for application and menu bar icons?
How can I locate all the references to a method using Roslyn Refactor?