get the selected item from dropdown #2579
-
The documentation shows how to create static dropdowns, but doesn't show how to get the selected item from js, and also doesn't show how to update the items in the dropdown list. It would be helpful if the documentation showed not only static examples (as it does today), but also how to modify elements with JS and get values out of user selectable items from js as well. Here is my static dropdown
I want to be able to add more items on the fly, and I also need to get the current selection and when the user changes the selection from js. How do I do this with jquery? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Think you’d need to re-init the dropdown with the values as per https://fomantic-ui.com/modules/dropdown.html#initializing-with-javascript-only or
Can use the |
Beta Was this translation helpful? Give feedback.
Think you’d need to re-init the dropdown with the values as per https://fomantic-ui.com/modules/dropdown.html#initializing-with-javascript-only or
$(‘.ui.dropdown’).dropdown(‘change values’, values);
- i don’t think there’s anything to append on an itemCan use the
onChange
callback otherwise can use$(‘.ui.dropdown’).dropdown(‘get value’);