this worked without "#" i inspeacted jquery in browser
xxxxxxxxxx
//add option to select with jQuery
$('#selectID').append($('<option>', {
value: 1,
text: 'Option Text'
}));
xxxxxxxxxx
//select tab in HTML
//<select name="names" id="mySelect"></select>
//jquery code
$("#mySelect").append(
$("<option>", {
value: "muhammad",
text: Muhammad,
selected: true
})
);
xxxxxxxxxx
$.each(items, function (i, item) {
$('#mySelect').append($('<option>', {
value: item.value,
text : item.text
}));
});
xxxxxxxxxx
// Assuming we have a <select> element with id "mySelect"
var mySelect = $("#mySelect");
var option = $("<option>").val("value").text("Option Text");
mySelect.append(option);