👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.

How to set HTML drop-down by value in jQuery?

The best way to select a given option in a HTML drop-down selector (<select><option>) is to use the .val() method. Let's consider the following example:

<select id="mySelector">
	<option value="option1">Choice 1</option>
	<option value="option2">Choice 2</option>
	<option value="option3">Choice 3</option>
</select>

The following jQuery set option2 as selected:

// Selection option 2 from drop-down list with ID mySelector
$('#mySelector').val('option2');

More