7

How to get value of selected dropdownlist.

Ex.

" Text="---Select---" Value="0">"

I need value "0".

Thanks,

1
  • could you post the generated html? Commented May 9, 2012 at 8:45

3 Answers 3

40

To get value:

$('#YourdropDownId').val(); 

To get text:

$('#YourdropDownId :selected').text(); 
Sign up to request clarification or add additional context in comments.

Comments

1

Try

$('[name="YourdropDownName"] option:selected').val(); 

Comments

0

Have seen similar answers but $('#YourdropDownId').val() never worked for me with jQuery 1.10.2

Instead I have to use $("select[id*=ddlurgency]").val() for:

<select name="urgency" id="ddlurgency" class="form-control" runat="server"> <option value="970200000">Not very urgent</option> <option value="970200001">Urgent</option> <option value="970200002">Very urgent</option> </select> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.