使用以下代码选择:
<select name="province" id="province" required="required"> <optgroup label="Provinces"> <option value="Alberta">Alberta</option> <option value="British Colombia">British Colombia</option> <option value="Manitoba">Manitoba</option> <option value="New Brunswick">New Brunswick</option> <option value="Newfoundland and Labrador">Newfoundland and Labrador</option> <option value="Nova Scotia">Nova Scotia</option> <option value="Ontario" selected="selected">Ontario</option> <option value="Prince Edward Island">Prince Edward Island</option> <option value="Quebec">Quebec</option> <option value="Saskatchewan">Saskatchewan</option> </optgroup> <optgroup label="Territories"> <option value="Northwest Territories">Northwest Territories</option> <option value="Nunavut">Nunavut</option> <option value="Yukon">Yukon</option> </optgroup> </select>
我需要具有与指南所要求的选项相同的值。此代码工作正常但不通过W3C验证:
A
select
element with arequired
attribute and without amultiple
attribute,and whose size is 1,must have a childoption
element.
这个问题的解决方案是什么?