var arr = [
{val : 1, text: 'One'},
{val : 2, text: 'Two'},
{val : 3, text: 'Three'}
];
var sel = $('<select>').appendTo('body');
$(arr).each(function() {
sel.append($("<option>").attr('value',this.val).text(this.text));
});
More Related Contents:
- HTML nchor Tag doesn’t show link
- How to change color of SVG image using CSS (jQuery SVG image replacement)?
- jQuery Ajax error handling, show custom exception messages
- How to trigger a click on a link using jQuery
- Catch error if iframe src fails to load . Error :-“Refused to display ‘http://www.google.co.in/’ in a frame..”
- JQuery Event Handlers – What’s the “Best” method
- Submitting HTML form using Jquery AJAX
- jqGrid custom format fails on addClass
- The specified value does not conform to the required format yyyy-MM-dd
- Can I load external stylesheets on request?
- What’s the difference between jQuery .val() and .attr(‘value’)?
- AJAX jQuery.load versus jQuery.get
- angular.element vs document.getElementById or jQuery selector with spin (busy) control
- jQuery :first vs. .first()
- Should one replace the usage addJSONData of jqGrid to the usage of setGridParam(), and trigger(‘reloadGrid’)?
- Getting text within element excluding decendants
- Creating a json object in jsp and using it with JQuery
- File upload using MVC 4 with Ajax
- Trigger click on select box on hover
- How to merge cells in jqGrid 4.0
- What is the difference between XMLHttpRequest, jQuery.ajax, jQuery.post, jQuery.get
- jQuery to retrieve and set selected option value of html select element
- jQuery – Check if DOM element already exists
- jQuery – keydown / keypress /keyup ENTERKEY detection?
- How to refresh the src of with jQuery?
- What’s faster for including scripts, using CDN (Google) or storing them locally in website’s root?
- Is there a difference between $().ready() and $(document).ready()
- The .fadeOut() method to use visibility property instead of display property
- Load content with ajax in bootstrap modal
- Can jQuery selectors be used with DOM mutation observers?