Checked Checkbox value in span

rkszteams

New Member
I am using a filter for a site and need those checked values to be show in a div in a span. I have gone through the article of Stack Overflow in which it is showing in a div, but I want the value to be show in span tag. Below is the code I am using of Stack Overflow for the values.jQuery:\[code\]$(document).ready(function(){ var el = $('.dropdown_box '); var text= el.text(); $('.dropdown_container').on('click', 'li', function() { var filter = []; $.each($('.dropdown_container').find(':checked'), function(i, el) { filter.push(el.value); }); el.text(text + ('') + filter.join ('')); });});\[/code\]HTML:\[code\]<div class="dropdown_box"> Filter Items :</div><div class="dropdown_container"> <ul> <li><input type="checkbox" name="filter[]" value="http://stackoverflow.com/questions/15715932/Black" class="cbx"/>Black</li> <li><input type="checkbox" name="filter[]" value="http://stackoverflow.com/questions/15715932/Red" class="cbx"/>Red</li> <li><input type="checkbox" name="filter[]" value="http://stackoverflow.com/questions/15715932/brown" class="cbx"/>brown</li> <li><input type="checkbox" name="filter[]" value="http://stackoverflow.com/questions/15715932/pink" class="cbx"/>pink</li> <li><input type="checkbox" name="filter[]" value="http://stackoverflow.com/questions/15715932/purple" class="cbx"/>purple</li> <li><input type="checkbox" name="filter[]" value="http://stackoverflow.com/questions/15715932/Orange" class="cbx"/>Orange</li> </ul></div>\[/code\]
 
Back
Top