The checkbox is always on
3 answers
Your checkbox is irrelevant, so JavaScript uses the default. If you want something else you need to use the value attribute value="some value"
. Also, the code does not check if the checkbox was checked or not, so it always gives you the value of the checkbox whether it is checked or not.
for example
<input type="checkbox" onclick="if(this.checked) { alert(this.value); }" />
Only anything will be displayed if the checkbox is checked.
+5
source to share