I have set the html checkbox the checked property

2019-02-16 08:26发布

here is my html markup:

<input type="checkbox" checked="false">

I have set the checked to false, but the result is still checked

Why this happened? If I remove the checked property, it would turn unchecked.

Actually I want insert a input[type=checkbox] into html markup in dynamic, with parameter to determine checked or not

1条回答
Summer. ? 凉城
2楼-- · 2019-02-16 09:19

If you specify checked, then it is checked; it doesn't matter if you say checked="false", checked="true", checked="checked" or just plain checked.

If you don't want it checked, then do not include the checked attribute.

<input type="checkbox" />

See: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_input_checked

查看更多
登录 后发表回答