[英]JQuery Error: TypeError: 'undefined' is not a function
I've been using JQuery recently and all was going well…and then this came up and I'm very confused by it. 我最近一直在使用JQuery,但一切进展顺利……然后出现了这个问题,对此我感到非常困惑。 I created a new page for testing purposes, and am getting the same error no matter what I try… 我创建了一个用于测试目的的新页面,无论尝试什么,都会遇到相同的错误……
The HTML code is: HTML代码是:
<div id="a" ></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('#a').hmtl("<div>test</div>");
});
</script>
And the error is: TypeError: 'undefined' is not a function (evaluating '$('#a').hmtl("<div>test</div>")')
. 错误是: TypeError: 'undefined' is not a function (evaluating '$('#a').hmtl("<div>test</div>")')
。 Most of the answers I found here said to load JQuery before the script, which I am doing, to no avail. 我在这里找到的大多数答案都说在我正在执行的脚本之前加载JQuery是无济于事的。
Thanks... 谢谢...
change 更改
$('#a').hmtl("<div>test</div>");
to 至
$('#a').html("<div>test</div>");
You have a spelling mistake: $('#a').hmtl("<div>test</div>");
您有一个拼写错误: $('#a').hmtl("<div>test</div>");
. 。 It should be html
not hmtl
. 应该是html
而不是hmtl
。
the function is undefined because it's not hmtl but html 该函数未定义,因为它不是hmtl而是html
thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.