jquery | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

jquery

How to i get unselected options in dropdown , when user selected the option im gtng like $(“#id option:selected”).val() or .text but i want unselected values for checking dynmaic conditions.. if any one knw kindly share ur answers. Thank you

22nd Apr 2018, 9:34 AM
Mőhåň Ķűmæř
Mőhåň Ķűmæř - avatar
1 Answer
+ 2
<select id="sel"> options </select> $("#sel option:not(:selected)") will return an array of objects containing the not selected ootions. can do $.each($("#sel option:not(:selected)"), function() { // do something with $(this).val() });
22nd Apr 2018, 9:45 AM
Adam
Adam - avatar