Answers for "oncheck checkbox javascript"

11

javascript check uncheck checkbox

document.getElementById("myCheckBoxID").checked = true; // Check
document.getElementById("myCheckBoxID").checked = false;// Uncheck
Posted by: Guest on August-02-2019
2

javascript checkbox onchange

<!-- Find values of checked boxes with jquery -->
<div class="fruit">
  <label>
    <span>Apple</span>
    <input onchange="checkValues()" name="apple" type="checkbox" value="apple">
  </label>

  <label>
    <span>Banana</span>
    <input onchange="checkValues()" name="banana" type="checkbox" value="banana">
  </label>

  <label>
    <span>Grape</span>
    <input onchange="checkValues()" name="grape" type="checkbox" value="grape">
  </label>
</div>

<script>
  function checkValues() {
    $('.fruit input:checkbox').each(function(index, element) {
      if (element.checked === true) {
        console.log(element.value)
      }
    });
  }
</script>
Posted by: Guest on July-28-2021
0

oncheck checkbox javascript

<input type='checkbox' onchange='handleChange(this);'> Checkbox

function handleChange(checkbox) {
    if(checkbox.checked == true){
        document.getElementById("submit").removeAttribute("disabled");
    }else{
        document.getElementById("submit").setAttribute("disabled", "disabled");
   }
}
Posted by: Guest on June-23-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language