I am populating a select menu with getJSON. I am wondering if there\'s a way that I can use jQuery\'s .each function to bring in these values?
Surely there must be
You can use a for loop.
for (var i = 0, len = data.length; i < len; i++)
$("select.month")
.append("");
If you want to achieve maximum performance, you should reduce the DOM operations to a minimum, like this:
var html = [];
for (var i = 0, len = data.length; i < len; i++) {
html[html.length] = "";
}
$("select.month").append(html.join(''));