I have an array like this:
["News & Politics", "Personal Journals", "Society & Culture", "Technology", "Arts", "Natural Sciences", "Business", "Comedy", "History", "Tech News", "TV & Film", "Design", "Performing Arts", "Education", "Christianity", "Investing", "Sports & Recreation", "Professional", "Social Sciences", "Automotive", "Science & Medicine", "Management & Marketing", "Sexuality", "Philosophy", "Self-Help", "Literature", "Buddhism", "Places & Travel", "Music", "Language Courses", "Careers", "Food", "Kids & Family", "National"]
I need to "push" these values into a select
with each of the items in the array being it's own option
.
How do I go about accomplishing this?
The array is stored as variable all_cat_unique
, but (of course) the following doesn't work. I just appends the entire array to the select a bunch of times.
$.each(obj.entry, function(i, data) {
$('#all-categories').append('<option>'+all_cat_unique+'</option>');
});
Thanks.