mercredi 24 janvier 2018

Checkbox sends same value, no matter if checked or not - javascript, html

I have a checkbox on my site looking like this:

<input type="checkbox" class="form-control" id="jobfixedstart_cb" onclick="jobfixedstartfunc();" />

In a Javascript .onClick-Event I get the value of the checkbox like this:

var addjobfixedstart = document.forms["add-new-job"].jobfixedstart_cb.value;

Now, no matter if the checkbox is checked or not, the value of "addjobfixedstart" is always "on". If I give the checkbox a value, it always sends the value.

What am i doing wrong?




Aucun commentaire:

Enregistrer un commentaire