I have a list of checkboxes and a div
<input class="option" value="black option" />
<input class="option" value="red option" />
<input class="option" value="green option" />
<div class="option_list"> </div>
I need the options that are checked off to show in the div.
I tried this
var option_array = new Array();
$('.option').click(function () {
var option = $(this).val();
option_array.push(option);
$('.option_list').html($.each(option_array, function (key, value) {
value + "<br>";
}));
});
It adds the selected option to the option_list
div, but does not print the html line break tag. In fact, I can take out the code between the { } and it does the same thing. I'm missing something here.