I have a bunch of radio boxes on my HTML page. Somewhat like this:
$( '#my-button-id' ).click( function() {
var tmp = '';
$( '.custom:checked' ).each( function() {
// Do what you want...
tmp += ' ' + $( this ).val();
});
alert( tmp );
});
The following will put the value of the value
attribute for each selected radio button into the arr
Array:
var arr = [];
$(".custom:checked").each(function () {
arr.push($(this).val());
});
Try this code
$('#buttonId').click( function() {
var result = '';
$('input:checked').each(function() {
result += ',' + $(this).val();
});
alert(result);
});