我正在尝试使用 HTML5 和 Bootstrap 验证某些表单,对于我尝试的小部件:
<div class="control-group">
<label class="control-label required-field">Person Type:</label>
<div class="controls">
<ul class="person-field person-field-select">
<li class="person-type-one" href="/ff/pf/add/" title="People with type one."><label for="id_person_0"><input class="person-field person-field-select" id="id_person_0" name="person" type="radio" value="F" /> Person One</label></li>
<li class="person-type-two" href="/ff/pj/add/" title="People with type two."><label for="id_person_1"><input class="person-field person-field-select" id="id_person_1" name="person" type="radio" value="J" /> Person Two</label></li>
</ul>
<br class='clear' />
</div>
</div>
在http://validator.w3.org/check中验证 HTML 后,我得到了错误:
此时不允许在元素 li 上使用属性 href。 元素 li 的属性:全局属性 如果元素是 ol 元素的子元素:值
我也尝试使用并得到同样的错误:
<!doctype html>
<html lang="en">
<div class="control-group">
<label class="control-label required-field">Person Type:</label>
<div class="controls">
<ol class="person-field person-field-select">
<li class="person-type-one" href="/fornecedores/pf/add/" title="People with type one."><label for="id_person_0"><input class="person-field person-field-select" id="id_person_0" name="person" type="radio" value="F" /> Person One</label></li>
<li class="person-type-two" href="/fornecedores/pj/add/" title="People with type two."><label for="id_person_1"><input class="person-field person-field-select" id="id_person_1" name="person" type="radio" value="J" /> Person Two</label></li>
</ol>
<br class='clear' />
</div>
</div>
</html>
在这里使用 href 元素的正确方法是什么?