I\'d like to populate a hidden input with the values of selected checkboxes with a space between these values. I\'ve tried the following which in theory should work but it i
You just need to change your selector and attach your script to some event. For example:
$('input[type=checkbox]').change(function() { var vals = $('input[type=checkbox]:checked').map(function() { return $(this).val(); }).get().join(','); $('#tags').val(vals); });
See this DEMO.