HTML输入必需属性不适用于字段

时间:2014-07-08 14:03:03

标签: html

我正在尝试进行一些客户端验证,当我将所需属性添加到HTML输入时,但它仅适用于某些字段。

<input type = "text" name="description" id = "descriptionOfChange" required> //this works
<input type = "text" name = "cid" id = "cid" required> //this does not work(also is my primary key. Not sure if that is the reason why)
<input type="text" name = "dateOfCompletion" id="datepicker" required /> //this works too

1 个答案:

答案 0 :(得分:0)

它应该可以正常工作,但只是为了确保,试试这个:

<input type = "text" name = "description" id = "descriptionOfChange" required /> 
<input type = "text" name = "cid" id = "cid_css" required /> 
<input type = "text" name = "dateOfCompletion" id = "datepicker" required />

虽然不需要半封闭此标记,但它可能会使某些浏览器以奇怪的方式运行,尤其是IE。