How to set selected value of jquery select2
Example 1:
$('#all_contacts').select2('data', {id: '123', text: 'res_data.primary_email'});Example 2:-
<select name="mySelect2" id="mySelect2">
<option value="0">A</option>
<option value="1">B</option>
<option value="2">C</option>
</select>
/* //////////// "One" will be the selected option */
$('[name=mySelect2]').val("0");
You can also do so:
$("#mySelect2").select2("val", "0");
Comments
Post a Comment