使用data-href的W3C验证错误 [英] W3C validation error with data-href
本文介绍了使用data-href的W3C验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于我在使整个DIV可点击的情况下使用data-href =,所以我得到一个验证错误。 JS和HTML如下。我可以做些什么来使这个W3C兼容?
I am getting one validation error due to my use of data-href="" in the context of making a whole DIV clickable. The JS and HTML is below. What could I do to make this W3C compliant?
JQUERY
$(function(){
$(".linked").click(function(){
window.location = $(this).attr("data-href");
return false;
});
});
HTML
<div class="" data-href="link.html"></div>
推荐答案
如果可能的话,您应该考虑使用 doctype 支持 data - *
属性。对于HTML5,即:
If possible, you should consider using a doctype that supports data-*
attributes. For HTML5, that's:
<!DOCTYPE html>
这篇关于使用data-href的W3C验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文