Select any dropdown selected option through jquery

In this code, we have to select input type as select and in options of select, we will dynamically make selected one of the options.

HTML code will like

 <select class="form-control select2" data-toggle="select2" name="question_type" id="question_type" required>        
<option value="">select_type'</option>
<option value="1"> 1 </option>
<option value="2"> 2 </option>
<option value="3">3 </option>
</select>

Script be like

 $("#question_type").val("1");  

Tags: No tags

Leave A Comment

Your email address will not be published. Required fields are marked *