“此时在元素div上不允许使用属性名称" [英] "Attribute name not allowed on element div at this point"
本文介绍了“此时在元素div上不允许使用属性名称"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到了我不明白的W3V验证器错误:
I am getting a W3V validator error that I can't understand:
第31行,第61列:此时元素
div
上不允许使用属性name
.
Line 31, Column 61: Attribute
name
not allowed on elementdiv
at this point.
这是这一行:
<div name="message" class="jGrowl bottom-right errorGrowl"></div>
完整HTML:
<!DOCTYPE html>
<html>
<head>
<title>jGrowl</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
<script type="text/javascript" src="data/awo-jgrowl.js"></script>
<script type="text/javascript" src="data/shortcut.js"></script>
<link rel="stylesheet" type="text/css" href="data/awo-jgrowl.css">
<script type="text/javascript">
$(document).ready(function() {
$('div[name=message]').awomsg('Input message', {sticky: true});
});
shortcut.add("m",function() {
$('div[name=message]').awomsg('Input message', {sticky: true});
});
shortcut.add("h",function() {
alert('ur doin it wrong');
});
</script>
</head>
<body>
<div name="message" class="jGrowl bottom-right errorGrowl"></div>
</body>
</html>
推荐答案
错误消息似乎很容易解释.您不能在div
标记上具有name
属性.因此您的代码可能如下所示:
The error message seems pretty self explanatory. You cannot have a name
attribute on a div
tag. So your code could look like this:
<div id="message" class="jGrowl bottom-right errorGrowl"></div>
,然后使用ID选择器:
and then use id selectors:
$('div#message')...
这篇关于“此时在元素div上不允许使用属性名称"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文