Answers for "checkbox is selected when value 1"

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
0

how to take value only from the checked checkbox

document.getElementById('select').onclick = function() {
  var checkboxes = document.getElementsByName('vechicle');
  for (var checkbox of checkboxes) {
    if (checkbox.checked)
      document.body.append(checkbox.value + ' ');
  }
}
Posted by: Guest on January-23-2021
0

how to take value only from the checked checkbox

$(document).ready(function() {
  $('#select').click(function() {
    $('input[type="checkbox"]:checked').each(function() {      // $(':checkbox:checked')
      document.body.append(this.value + ' ');                  // $(this).val()
    });
  });
});
Posted by: Guest on January-23-2021

Code answers related to "checkbox is selected when value 1"

Code answers related to "ActionScript"

Browse Popular Code Answers by Language