Fraz Sundal
Fraz Sundal

Reputation: 10448

Find value in dropdown and then select it through jquery

I want to find out a value which is present in dropdown list and then select that value as selected object in dropdownlist. Im using jquery

Upvotes: 1

Views: 304

Answers (2)

alex
alex

Reputation: 490597

In addition to Rahul's great answer, if you want to select it by its index, you can do...

$('select#my')[0].selectedIndex = 5;

Upvotes: 2

rahul
rahul

Reputation: 187110

If you want to select the option with a value you can use

$("#dropdownid").val(yourvalue);

Working Demo

Upvotes: 4

Related Questions