“生成的”在哪里?归因允许吗?
我在 IntelliJ 中收到此错误:
此处不允许使用“生成”属性
html 片段所在位置:
<label generated="true" ... >
生成
是“真正的”HTML 属性吗?如果验证失败,它会由 jquery-ui-validation 插件添加到错误字段上。哪里允许呢?
I'm getting this error in IntelliJ:
Attribute 'generated' is not allowed here
Where the html snippet is:
<label generated="true" ... >
Is generated
a "real" HTML attribute? It is added by the jquery-ui-validation plugin, on the error fields if validation fails. Where is it allowed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原始答案:什么是“某些 HTML 标记中出现的“generate”属性用于做什么?
这是自定义数据 或用户定义 属性。在您的例子中,它被添加来表示加载后在页面上生成的元素,可能是由 JavaScript 生成的。
在繁重的 UI/UX Web 应用程序中经常会看到其他此类属性。它们通常充当技术(CSS、JavaScript、HTML 等)之间的挂钩。
请注意,此类属性不会进行验证。如果您使用的是 HTML5,则可以使用
data-
前缀来解决此问题(即data- generated="true"
)。详细了解有关 HTML5 中的自定义数据属性。orignal answer at : What is the "generated" attribute seen in some HTML tag used for?
This is a custom data or user-defined attribute. In your case it has been added to denote an element that was generated on the page after it loaded, probably by JavaScript.
It's common to see other such attributes in heavy UI/UX web applications. They typically serve as hooks between technologies - CSS, JavaScript, HTML, etc.
Note that such attributes do not validate. If you are using HTML5, you can prefix them with
data-
to get around this issue (i.e.data-generated="true"
). Read more about custom data attributes in HTML5.