Javascript examples for jQuery Method and Property:append
Append to a jQuery object in order without using a parent $('<div>')
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.1.js"></script> <script type="text/javascript"> $(window).load(function(){//from w ww . ja v a 2s. co m var options = []; for (var i = 0;i < 10; i++) { var $option = $('<option/>') $option.text(i); $('.target-class').append($option); } }); </script> </head> <body> <select class="target-class"></select> </body> </html>