Grabbing the selected value from a label/value list?
See original GitHub issueSo if I instantiate with a list like this:
awesomplete.list = [ [ "Belarus", "BY" ], [ "China", "CN" ], [ "United States", "US" ] ];
Then I’ll end up with the value in my user’s input. I’m trying to have the label appear in the input upon selection, but also be able to know what value matches their choice, so I can stick that in a hidden input.
So for the above, if the user chose “China”, I’d like “China” to show up in their choice, but have “CN” get stashed in a variable/hidden input field.
Is Replace the right method for doing this?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to grab label value from checked option with jQuery
Im trying to grab value from label checkbox:checked. I have created this function var levels = $('input[name=form[radio1]]:checked + label') ...
Read more >How i can get the label of the selected value in Combobox
I'm developing a LWC Combobox and I want to get the label of the selected value in the handleChange() method, not the id...
Read more >Selected value not showing in the input field [Controlled ...
It set's the value from an onChange correctly, and the props update and console.log properly, but the component doesn't visually show the new ......
Read more >How does ARAS manipulate the values in a dropdown list ...
To provide some context about why I'm asking, I'm grabbing the user's selected value from the dropdown list via javascript and then doing ......
Read more >Solved: Change the value of a label based on a selected va...
Solved: Hi, I have sharepoint list T012. And two columns MineName and MineID. In power app I have a dropdown with the values...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
just instantiate the list like this:
awesomplete.list = [ {label: "Belarus", value: "BY"}, {label: "China", value: "CN"}, {label; "United States", value: "US"} ];
If you want to do something upon selection (eg. write value/label to a hidden field) check the event
awesomplete-selectcomplete
and use theevent.text.value
/event.text.label
variables.PRs are not merged FIFO. Easy, small, uncontested PRs are merged ahead of any backlog.