vendredi 19 février 2021

Javascript checkboxes with the same class name

I would like to do when I check one checkbox the other checkboxes get disabled not the checked checkbox.

let checkbox = document.querySelector(".checkbox");

function check() {

    if (checkbox.checked) {
    checkbox.disabled = "true"
} 

}
 <input onclick="check()" class="checkbox" type="checkbox">
  <input onclick="check()" class="checkbox" type="checkbox">
   <input onclick="check()" class="checkbox" type="checkbox">
    <input onclick="check()" class="checkbox" type="checkbox">



Aucun commentaire:

Enregistrer un commentaire