Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Dropdown selected value on client side onchange event?

I have written a code for dropdown selected index changed event at client side using onchange event and create one JavaScript function. Now, I want to retrieve selected values in this function. How can I get this value?

like image 395
Atul Patel Avatar asked Jan 30 '12 10:01

Atul Patel


2 Answers

This will give you selected text.

$("#mydropdownid option:selected").text(); 

This will give you selected value

$('#mydropdownid').val();
like image 38
devson Avatar answered Sep 30 '22 18:09

devson


$("#DropDownlist:selected").val();
like image 77
Anwar Avatar answered Sep 30 '22 18:09

Anwar