jeudi 26 mai 2016

Verify checked checkbox javascript

I'm trying to update in "real time" if I check and uncheck in a list of checkboxs.

With this code:

window.onload = function () {
  var input = document.getElementById('listTaxi');

  function check() {
      var a = input.checked ? "checked" : "not checked";
      console.log(a);
  }
  input.onchange = check;
  check();
}

I can do this for one checkbox, but how can I make for multiple checkboxs? A list(div) of checkboxs?

Thanks!!




Aucun commentaire:

Enregistrer un commentaire