Alex Rivera | Logout

Set the default value in dropdownlist using jQuery

Asked 2011-01-24T11:28:26.270
56

I have many options in my dropdownlist like:

<option value="1">it's me</option>

I need to select the option who have value it's me inside the tag, not by attribute like 1.

How can I do this using jQuery?

Edit
Report

2 Answers

47

You can just do this:

$('#myCombobox').val(1)
answered 2011-01-24T11:39:31.220
0

This is working fine:

$('#country').val($("#country option:contains('It\'s Me')").val());
answered 2011-01-24T11:33:58.340

Your Answer