【发布时间】:2011-02-21 22:17:28
【问题描述】:
听起来有点像一个愚蠢的问题,但我想知道在 HTML 中说明复选框已选中/未选中的最佳方式是什么。
我见过很多不同的例子:
<input type="checkbox" checked="checked" />
<input type="checkbox" />
<input type="checkbox" checked="yes" />
<input type="checkbox" checked="no" />
<input type="checkbox" checked="true" />
<input type="checkbox" checked="false" />
哪些浏览器可以与其中的哪些一起使用,最重要的是,jQuery 是否可以确定在所有 3 个中选中了哪个框?
编辑: W3C 规范似乎暗示只有经过检查的 attr 是正确的。这是否意味着checked="false" 和checked="no" 仍然会选中该框?
【问题讨论】: