trying to use jquery tooltip plugin, object has no method “tooltip”

南楼画角 提交于 2019-11-29 14:20:49

You should reorder your js files:

<script type="text/javascript" src="/scripts/jquery.min.js"></script>
<script src="http://cdn.jquerytools.org/1.2.6/jquery.tools.min.js" type="text/javascript"></script>
<script src="/javascripts/home.js" type="text/javascript"></script>

A little more explanation for anyone else having this problem:

Scripts are loaded in the order they're called, so you want to load jQuery first, then any plugins, then your custom code.

Got this problem too, and it was because of an old version of jquery lost in the sources folder, was jquery v1.6.2. If it can help someone... Have a nice day!

Wrap $("#boo img[title]").tooltip(); in $(function(){ }); so you end up with:

$(function(){
    $("#boo img[title]").tooltip();
});

Why:

The $(function()... is a short cut to execute that code on the domReady event. So at that point all of the jquery files, and the page, will be loaded far enough for your javascript to work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!