I have a checkboxlist control and would like to get all the checkbox values that are checked concatenated into a string separated by '-'. Is there any functions for this? Ex:
$('#checkboxes input[type=checkbox]:checked').concat('-');
Check out this previous post. Perhaps using the map() function will work for you.
$('#checkboxes input[type=checkbox]:checked').map(function() {
return $(this).val();
}).get().join('-');
I think you want to look at jQuery's .map() functionality (not tested):
$('#checkboxes input[type=checkbox]:checked').map(function() {
return $(this).attr('value');
}).get().join('-');
That kind of depends on what you are trying to do. For example -
var list = ''
$('#checkboxes input[type=checkbox]:checked').each(function(){
list += $(this).val() + '-'
});
Would give you a list with dash separated values but if you are looking to do this for form processing/submission, check into .serialize()
item1-item2-item3-