So, I am trying to append the options to the HTML5 select using jquery but it doesnt work for some reason. Following is my code:
for (var i = 0; i < itemsList.length; i++) {
WL.Logger.debug(itemsList[i]);
var elem = $("<option/>").val(itmesList[i]).text(itemsList[i]);
$('#itemsList').append(elem);
}
Here itemsList is an array of items whose value i want to append to the select dropdown box whose id is itemsList as well. here is the html code:
<div id="wrapper">
<label for="itmesList">Select item: </label>
<select id="itmesList"></select>
<div id="info"></div>
</div>
Any ideas what I am doing wrong here?
Thanks!
HTML:
JQuery:
DEMO:
http://jsfiddle.net/Simplybj/WKfak/