Sunday, 15 April 2012

javascript - How do I give an unchecked checkbox value in HTML? -


I am trying to create it so that there is no check box in the check box, while there is an uncheck checkbox value.

gt; pre & lt; & Lt; Input style = "visibility: hidden" type = "checkbox" name = "box" value = "one" checked /> & Lt; Input type = "checkbox" name = "box" value = "b" check /> & Lt; / Form & gt; Obviously at one point, it works as a second check box, it is believed that the value of the previous is overridden. But now, it seems that both values ​​are presented.

Any thoughts?

The reason is that you are using the checkbox, change your code to:

  & lt; Form & gt; & Lt; Input style = "visibility: hidden" type = "radio" name = "box" value = "a" check /> & Lt; Input type = "radio" name = "box" value = "b" check /> & Lt; / Form & gt;   

Input type radio accepts only one option, while the checkbox takes more than one option from one group, so when the user can not remove the check from the top, both of you The server side is sent

No comments:

Post a Comment