您的位置:首页 > 其它

关于webstorm对input textarea 等表单元素提出的警告问题

2015-10-15 09:15 567 查看
<input type="text" name="" id=""/>

普普通通的表单元素,在webstorm里却无情的给出警告

Form input without an associated label less... (Ctrl+F1)

This inspection highlights form elements without required associated label and provides the ability to create a new label     

大致的意思我也没看懂,反正就是标签不对什么的

百度了一整,发现百度上讲这个的基本上没有,坑叔啊

于是上了雅虎,嘿,雅虎就是好,直接让我找到了相关的英文资料,原文如下

This is not an error, however it's recommended to associate labels with corresponding form elements for the sake of
UX convenience. For example for the name field:

翻译成中文大概意思就是

这不是一个错误,但是它的建议将标签与UX方便起见相应的表单元素。例如为名称字段:

然后给出一个示例

<label for="name">Nazwa:</label>
<textarea class="form-control" id="name" name="newTodo" data-ng-model="formData.newTodo" required></textarea>

原来是webstorm太聪明导致的。

当然这个错误可以忽略不计,但是遵循html5的标准,上面的写法是及其规范的。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: