Just wondering what the best practice for programmatically getting the value of a selected item from a dropdown. I know I need to listen to the 'onCalciteDropdownSelect' event, then go into 'target' and finally 'selectedItems'. But from there, what should I use to get the value?
Solved! Go to Solution.
@Danik-B Thanks for reaching out! Since you mentioned "onCalciteDropdownSelect", assume you might be using React? If so, you could leverage the useState hook with the Dropdown Item's "label" property/attribute.
Here's an example without a framework to showcase some of what the process could work towards.
@Danik-B Thanks for reaching out! Since you mentioned "onCalciteDropdownSelect", assume you might be using React? If so, you could leverage the useState hook with the Dropdown Item's "label" property/attribute.
Here's an example without a framework to showcase some of what the process could work towards.
@KittyHurley Thanks for that. I was using innerText but I like the idea of using label. Thanks for the solution.