Return CheckBox True False Status With jQuery Map

I am creating dynamic CheckBoxes using jQuery and by default, those are set to false status. Something as follows:

<input type="checkbox" class="cbCheck" value="false" />

So you can see no value or id is assigned there. Is it possible to just retrieve the true/false based on CheckBox checked/unchecked status something as follows using jQuery mapping?

string = $('input[type=checkbox]:checked').map(function (i, elements) {
    return elements; //Here the elements like true or false, instead of elements.value
});

alert(string.join(','));

Expected Output: true, false, false, true (Based on user selection)

1 thought on “Return CheckBox True False Status With jQuery Map”

Leave a Comment