What's the easiest way to add an option
to a dropdown using jQuery?
Will this work?
$("#mySelect").append('<option value=1>My option</option>');
html-selectjavascriptjquery
What's the easiest way to add an option
to a dropdown using jQuery?
Will this work?
$("#mySelect").append('<option value=1>My option</option>');
Best Answer
Personally, I prefer this syntax for appending options:
If you're adding options from a collection of items, you can do the following: