I have a function like below to get the values of a series of radio that can either be True or False.
universalDetails = ['thing1', 'thing2', 'thing3'];
$.each(universalDetails, function(idx, name) {
universalDetails[idx] = {
name: name,
value: $('input[name=' + name + ']:checked', '#universalAttributes').val()
};
});
value
universalDetails
You can use .is()
to check the current element
value: $('input[name=' + name + ']', '#universalAttributes').is(':checked')
OR Use the length
property
value: $('input[name=' + name + ']:checked', '#universalAttributes').length > 0