tags:

views:

389

answers:

1

Hello,

Why within JQuery, the combobox add method doesn't seem to be recognized as with traditional html combobox here:

http://viralpatel.net/blogs/demo/dynamic-combobox-listbox-dropdown-in-javascript.html

+1  A: 

To get the actual DOM element in jQuery to call DOM methods on, use .get():

$("#myDropDown").get(0).add(option);

Please note though, there's another way to do this in jQuery:

$('#myDropDown').append($('<option></option>').val(myVal).html(optionText));

There's also the Select Box plugin if you're doing a lot more with selects.

Nick Craver
Hi thanks that's what I needed !