jeudi 15 octobre 2020

Why checkbox value is on when it's unchecked

The problem is that I get on value from check box when it's checked and when it's unchecked... what do I miss?

HTML checkbox code :

 <input type="checkbox" id="noextracharge" name="noextracharge"  >
                <label for="noextracharge">no extra charge</label><br>

to get the values from page's inputs I use :

 function getInputValues() {  //var enabledInputs array of inputs ids
      
        var inputValues = {};
        $.each(enabledInputs, function (index, inputId) {
            var input = $(inputId);
            inputValues[input.attr("name")] = input.val();
        });
        return inputValues;
    };



Aucun commentaire:

Enregistrer un commentaire