我想用所需的属性
问题描述:
为什么我不能在我的选择选项使用required
ATTRIB我想用所需的属性
<form>
<select required="" name="Furniture" id="Furniture" class="form-control input-lg" >
<option value="" disabled selected>Select Furniture</option>
</form>
答
尝试使用所需要的属性没有=""
,如下:
<select required>
<option value="">Select Furniture</option>
</select>
必需属性是布尔属性。
存在时,它指定在提交表单之前必须填写输入字段 。
+0
我不认为这是问题... OP使用'input type =“按钮”'而不是'input type =“submit”'。 –
答
必需是布尔属性。如果该属性存在,则表示所需属性的值为true,否则为false。它如果你使用HTML5,只需要写不需要双引号。 试试这个:
<form>
<select required name="Furniture" id="Furniture" class="form-control input-lg" >
<option value="" disabled selected>Select Furniture</option>
</form>
+0
我不认为这是问题...... OP使用'input type =“按钮”'而不是'input type =“submit”'。 –
你是指什么意思?你的'button'或'input' type =“submit”'在哪里? –
我需要的属性似乎不起作用 –
这里'' –