I am using the following lines to select the value of an option for a select menu element.
var chap = $("#xyz).val();
$('#qEchap').val(chap);
or
var chap = $("#xyz).val();
$('#qEchap option[value=chap]').attr("selected", "selected");
Both are not working. What is the right syntax to set option value for a HTML select menu?