The same as other answers, in a jQuery fashion:
$.each(selectValues, function(key, value) {
$('#mySelect')
.append($("<option></option>")
.attr("value", key)
.text(value));
});
Related Contents:
- jQuery get specific option tag text
- How do you remove all the options of a select box and then add one option and select it with jQuery?
- Change the selected value of a drop-down list with jQuery
- Adding options to a using jQuery?
- Removing an item from a select box
- jQuery remove options from select
- Check if option is selected with jQuery, if not select a default
- How to use jQuery to select a dropdown option?
- Creating a select box with a search option
- What is the most efficient way to sort an Html Select’s Options by value, while preserving the currently selected item?
- JQuery select2 set default value from an option in list?
- set option “selected” attribute from dynamic created option
- Hide select option in IE using jQuery
- What is the non-jQuery equivalent of ‘$(document).ready()’?
- Which keycode for escape key with jQuery
- jQuery/JavaScript to replace broken images
- Can I find events bound on an element with jQuery?
- Proper way to wait for one function to finish before continuing?
- How to find if div with specific id exists in jQuery?
- jQuery: Get height of hidden element in jQuery
- How to get the anchor from the URL using jQuery?
- Setting href attribute at runtime
- How to convert a Title to a URL slug in jQuery?
- Clear Text Selection with JavaScript
- How to check if a variable is null or empty string or all whitespace in JavaScript?
- Best way to detect Mac OS X or Windows computers with JavaScript or jQuery
- javascript, is there an isObject function like isArray? [duplicate]
- Call javascript function after script is loaded
- Eliminate 300ms delay on click events in mobile Safari
- Test if two elements are the same
- JQuery Ajax Post results in 500 Internal Server Error
- Stringify (convert to JSON) a JavaScript object with circular reference
- Sending credentials with cross-domain posts?
- Including a hyphen in a regex character bracket?
- Upload file with Ajax XMLHttpRequest
- get one item from an array of name,value JSON
- Jquery, checking if a value exists in array or not [duplicate]
- How can I select an element by ID with jQuery using regex?
- How to return an array from an AJAX call?
- How to select all textareas and textboxes using jQuery?
- Equivalent of ASP’s .Contains method [duplicate]
- call a function in success of datatable ajax call
- Jquery/JS prevent right click menu in browsers
- Count textarea characters
- Attaching ‘onclick’ event to D3 chart background
- Select2 limit number of tags
- Find the “potential” width of a hidden element
- What is slim in file.slim.js
- Javascript Debugging line by line using Google Chrome
- Close Bootstrap modal on form submit