qTip 返回错误“对象没有方法‘qtip’”
我正在使用另一个线程中的以下代码,并且由于未知原因,我收到以下错误:
未捕获类型错误:对象 [object Object] 没有方法“qtip”
代码:
$('.tooltip').each(function(){
$(this).qtip({
content: {text: $('#helptext_' + $(this).attr('id'))},
style: {classes: 'ui-tooltip-dark ui-tooltip-rounded'},
position: {my: 'left center',at: 'right center', viewport: $(window)}
});
});
I am using the following code from another thread and, for an unknown reason, I am getting the following error:
Uncaught TypeError: Object [object Object] has no method 'qtip'
Code:
$('.tooltip').each(function(){
$(this).qtip({
content: {text: $('#helptext_' + $(this).attr('id'))},
style: {classes: 'ui-tooltip-dark ui-tooltip-rounded'},
position: {my: 'left center',at: 'right center', viewport: $(window)}
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
确保在调用该函数之前调用
qtip.js
(或其他内容),否则在此代码运行时它不会被加载。Make sure you call the
qtip.js
(or whatever) before you call that function, otherwise it won't be loaded by the time this code runs.1) 到这里下载 qTip2 包...
http://craigsworks.com/projects/qtip2/ download/
2) 然后将其添加到您的
部分...
3) 添加此 qTip 脚本,其中包含您的 jQuery 之后 包含的某个位置。 。
1) Go here and download the qTip2 package...
http://craigsworks.com/projects/qtip2/download/
2) Then add this to your
<head>
section...3) Add this qTip script includes someplace just after your jQuery includes...
当我开始使用 qtip 时,我使用以下代码来检查 qtip 是否分配给元素:
这是错误的方式。当我更加熟悉 jquery 后,我纠正了我的错误。
检查是否有任何 qtip 连接到元素的正确方法是:
When I started to work with qtip, I have used the following code to check if the qtip is assigned to the element:
which is the wrong way. When I got more familiar with jquery I've corrected my mistake.
The right way to check if there is any qtip connected to the element is:
我发现我的拼写错误(
而不是
),但我也用它来消除与其他脚本的任何潜在冲突:您可以在此处了解更多信息:
http://docs.jquery.com/Using_jQuery_with_Other_Libraries
I found a typo in mine (
<scrpt> instead of <script>
), but I also used this to remove any potential conflicts with other scripts:You can learn more about it here:
http://docs.jquery.com/Using_jQuery_with_Other_Libraries