Answers for "how to get checked checkbox value from checkbox in html"

0

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 + ' ');
  }
}
Posted by: Guest on January-23-2021
1

checkbox value

<input type="checkbox" name="vehicle1" value="Bike">

The checkbox value is 'Bike'.
Posted by: Guest on July-27-2020

Code answers related to "how to get checked checkbox value from checkbox in html"

Browse Popular Code Answers by Language