dimanche 7 juin 2020

Checkbox value showing as `on` when unchecked

    <label for="filterByRcd">
      No GUI / Hi-Performance Mode
      <input type="checkbox" id="skipDraw" checked="checked">
    </label>

enter image description here

We can see it in the Elements section of chrome:

enter image description here

Here is the backend code translating to javascript variables:

_getSkipDraw() {
  let d = typeof this._skipDrawInput != "undefined" ? this._skipDrawInput.value == "on" : false
  return d
}

Surprisingly however the value of this._skipDrawInput is showing as on (and Therefore the variable d is being set to true instead of false):

enter image description here

Why is there this disconnect between the value and the actual state of the checkbox? Is there a different property needed to read its value?

Wh

Aucun commentaire:

Enregistrer un commentaire