简体   繁体   English

jQuery “数据”属性未经过 W3C 验证

[英]jQuery “data” attribute doesn't W3C validate

I'm wondering why this bit of html doesn't validate (XHTML 1.0 transitional) because of the "data" attribute.我想知道为什么 html 由于“数据”属性而无法验证(XHTML 1.0 过渡)。 I've searched around for answers, and I'm not using the jQuery metadata plugin, if that matters.我四处寻找答案,如果这很重要,我没有使用 jQuery 元数据插件。

Any way to get this to validate, or escape it so the validator doesn't see it?有什么方法可以验证或转义它以使验证器看不到它?

<div id="home" data-image="images/water.jpg">

Because data attributes are part of the HTML 5 spec .因为data属性是HTML 5 规范的一部分 Use <!DOCTYPE html> to specify the HTML 5 doctype.使用<!DOCTYPE html>指定 HTML 5 文档类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM