【发布时间】:2016-04-15 09:38:15
【问题描述】:
假设 HTML5,指示复选框、单选按钮或选择选项被选中或选中的正确方式是什么?
是不是这样,看起来很常用,但对我来说似乎是多余的:
<input type='checkbox' checked='checked'> I'm checked
<input type='radio' checked='checked'> I'm also checked
<select>
<option>First</option>
<option selected='selected'>I'm selected</option>
</select>
或者像这样,这似乎更有意义并且似乎也有效:
<input type='checkbox' checked> I'm checked
<input type='radio' checked> I'm also checked
<select>
<option>First</option>
<option selected>I'm selected</option>
</select>
后者是否存在兼容性问题?
【问题讨论】:
标签: html tags attributes selected checked