get value of checkbox javascript code example
Example 1: jquery on checkbox checked es6
$("input[type='checkbox']").on('change', (e) => {
console.log("Checked Value 'is' :: ", e.currentTarget.checked);
})
Example 2: how to take value only from the checked checkbox
document.getElementById('select').onclick = function() {
var checkboxes = document.querySelectorAll('input[type="checkbox"]:checked');
for (var checkbox of checkboxes) {
document.body.append(checkbox.value + ' ');
}
}