How to get selected option attribute? #131
Answered
by
sa-si-dev
nimeshgorfad
asked this question in
Q&A
-
How to get selected option attribute? |
Beta Was this translation helpful? Give feedback.
Answered by
sa-si-dev
Apr 15, 2022
Replies: 1 comment
-
To get any custom attribute, set it as VirtualSelect.init({
ele: '#sample-select',
options: [
{ label: 'Options 1', value: '1', customData: { v1: 1 } },
{ label: 'Options 2', value: '2', customData: { v1: 2 } },
],
}); Use getSelectedOptions() method to get selected options details It would return value, label, and customData properties from the options object |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
sa-si-dev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To get any custom attribute, set it as
customData
property inside the option's object while initializing.Use getSelectedOptions() method to get selected options details
It would return value, label, and customData properties from the options object