Amardeep Singh
Amardeep Singh

Reputation: 27

using popup with jquery

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

Answers (2)

Robin Maben
Robin Maben

Reputation: 23034

var option = $('<option />');
$('#select').append(option);

option.val('valueToAdd').html('visibleText');

Upvotes: 1

Dom
Dom

Reputation: 40463

I've made you a demo of what I think you are asking for... Let me know.

http://jsfiddle.net/AZ5Sm/44/

Upvotes: 0

Related Questions