简体   繁体   English

jQuery错误:TypeError:'未定义'不是一个函数

[英]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.

相关问题 经典的jQuery错误-Uncaught TypeError:undefined不是一个函数 - A classical jQuery error - Uncaught TypeError: undefined is not a function TypeError:未定义不是jQuery函数 - TypeError: undefined is not a function jQuery jQuery:TypeError&#39;undefined&#39;不是一个函数 - jQuery: TypeError 'undefined'is not a function jQuery UI对话框无法正常工作; 错误消息“ TypeError:未定义不是函数” - JQuery UI dialog not working correctly; error message “TypeError: undefined is not a function” Javascript JQuery Listview刷新错误消息-未捕获的TypeError:undefined不是函数 - Javascript JQuery Listview Refresh Error Msg - Uncaught TypeError: undefined is not a function JQuery选择菜单返回错误Uncaught TypeError:undefined不是函数 - JQuery select menu returning error Uncaught TypeError: undefined is not a function jQuery的,遗漏的类型错误:未定义是不是一个函数 - Jquery, Uncaught TypeError: undefined is not a function 未捕获的TypeError:undefined不是jQuery的函数 - Uncaught TypeError: undefined is not a function with jQuery TypeError:undefined不是一个函数(对于JQuery Sortables) - TypeError: undefined is not a function (for JQuery Sortables) 未捕获的TypeError:undefined不是函数-不是JQuery - Uncaught TypeError: undefined is not a function - not JQuery
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM