You can achieve this with different methods (remember if an element is to be operated, better give it an id or class, rather than having its parent element be an id or class):
Here,, as the div has a class to target the select inside it, the code will be:
$("div.id_100 select").val("val2");
or
$('div.id_100 option[value="val2"]').prop("selected", true);
If the class would have been given to select itself, the code will be:
$(".id_100").val("val2");
or
$('.id_100 option[value=val2]').attr('selected','selected');
or
$('.id_100 option')
.removeAttr('selected')
.filter('[value=val1]')
.attr('selected', true);
To pass the value dynamically, code will be:
valu="val2";
$("div.id_100 select").val(valu);
$("div.id_100 > select > option[value=" + valu + "]").prop("selected",true);
If element is added through Ajax, you will have to give 'id' to your element and use:
window.document.getElementById
Else you will have to give 'class' to your element and use
window.document.getElementById
You can also select the value of the select element by its index number.
If you have given ID to your select element, the code will be:
window.document.getElementById('select_element').selectedIndex = 4;
Remember when you change the select value as said above, the change method is not called.
I.e., if you have written code to do some stuff on change of select the above methods will change the select value but will not trigger the change.
To trigger the change function, you have to add .change() at the end.
So the code will be:
$("#select_id").val("val2").change();