I've been using JQuery recently and all was going well…and then this came up and I'm very confused by it. I created a new page for testing purposes, and am getting the same error no matter what I try…
The HTML code is:
<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>")')
. Most of the answers I found here said to load JQuery before the script, which I am doing, to no avail.
Thanks...
change
$('#a').hmtl("<div>test</div>");
to
$('#a').html("<div>test</div>");
You have a spelling mistake: $('#a').hmtl("<div>test</div>");
. It should be html
not hmtl
.
the function is undefined because it's not hmtl but html
thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.