Dear All,
I am posting this blog because most of the people are stuck in code when we want data from dropdown. So I decided to post this blog.
so this is my dropdown:-
<select required="" name="AssignedTo" id="LanguageToInvo" onchange="" class="form-control">
<option id="0" value="">--select---</option>
<option id="1" value="En">English</option>
<option id="2" value="Ar">Arabic</option>
<option id="3" value="EnAr">English and Arabic</option>
</select>
How to get selected value or text from the same. Using Jquery we can get it easily.
If you want value:-
jQuery("#availability option:selected").val();
$("#availability option:selected").val();
If you want to text :-
jQuery("#availability option:selected").text();
$("#availability option:selected").text();
Thank you,
Hope it helps you.
Best regards,
Arjun walmiki
I am posting this blog because most of the people are stuck in code when we want data from dropdown. So I decided to post this blog.
so this is my dropdown:-
<select required="" name="AssignedTo" id="LanguageToInvo" onchange="" class="form-control">
<option id="0" value="">--select---</option>
<option id="1" value="En">English</option>
<option id="2" value="Ar">Arabic</option>
<option id="3" value="EnAr">English and Arabic</option>
</select>
How to get selected value or text from the same. Using Jquery we can get it easily.
If you want value:-
jQuery("#availability option:selected").val();
$("#availability option:selected").val();
If you want to text :-
jQuery("#availability option:selected").text();
$("#availability option:selected").text();
Thank you,
Hope it helps you.
Best regards,
Arjun walmiki
No comments:
Post a Comment