Javascript examples for jQuery:Array
Add Array element to Select Option
<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 ww w . j a v a2s .c om*/ var selectList = {}; selectList[1] = "AAA"; selectList[2] = "BBB"; $.each(selectList, function (key, value) { $('#my').append($("<option/>", { value: key, text: value })); }); }); </script> </head> <body> <select id="my"></select> </body> </html>