How do I determine if a checkbox is checked?

前端 未结 9 2134
我在风中等你
我在风中等你 2020-11-27 05:23

For some reason, my form does not want to get the value of a checkbox... I am not sure if it is my coding or not, but when I try and alert() the value, I get

9条回答
  •  面向向阳花
    2020-11-27 05:58

    The line where you define lfckv is run whenever the browser finds it. When you put it into the head of your document, the browser tries to find lifecheck id before the lifecheck element is created. You must add your script below the lifecheck input in order for your code to work.

提交回复
热议问题