jQuery“数据"属性未通过W3C验证 [英] jQuery “data” attribute doesn't W3C validate

查看:67
本文介绍了jQuery“数据"属性未通过W3C验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道为什么这部分html由于数据"属性而无法验证(XHTML 1.0过渡版).我一直在寻找答案,并且如果需要的话,我没有使用jQuery元数据插件.

I'm wondering why this bit of html doesn't validate (XHTML 1.0 transitional) because of the "data" attribute. I've searched around for answers, and I'm not using the jQuery metadata plugin, if that matters.

有什么方法可以对此进行验证,或者是否对其进行转义以使验证者看不到它?

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">

推荐答案

因为data属性是

Because data attributes are part of the HTML 5 spec. Use <!DOCTYPE html> to specify the HTML 5 doctype.

这篇关于jQuery“数据"属性未通过W3C验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆