Reputation: 27
i am showing a popup on the click of particular option on the dropdown in the popup i am using a textbox and a save button on the click of save button the value of the textbox was saved into the database
now i want to show the currently add option in to the dropdown. i am unable to show it in the dropdown.
i am using the following code
var myselect = $('Select');
var othercountry = getValue1("txtCountry");
$.each(othercountry, function (val, text) {
othercountry.append($('<option></option>').val(val).html(text));
})
Upvotes: 0
Views: 233
Reputation: 23034
var option = $('<option />');
$('#select').append(option);
option.val('valueToAdd').html('visibleText');
Upvotes: 1
Reputation: 40463
I've made you a demo of what I think you are asking for... Let me know.
Upvotes: 0