What is the best method for adding options to a <select> from a JavaScript object using jQuery? I’m looking for something that I don’t need a plugin to do, but I would also be interested in the plugins that are out there. This is what I did: A clean/simple solution: This is a cleaned up and simplified version of matdumsa’s:
Tag: html-select
How do you remove all the options of a select box and then add one option and select it with jQuery?
Using core jQuery, how do you remove all the options of a select box, then add one option and select it? My select box is the following. EDIT: The following code was helpful with chaining. However, (in Internet Explorer) .val(‘whatever’) did not select the option that was added. (I did use the same ‘value’ in both .append and .val.) EDIT: Trying