jQuery TypeError: $(...).tooltip 不是函数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18279789/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 21:19:18  来源:igfitidea点击:

TypeError: $(...).tooltip is not a function

jquery-uijquery

提问by Sithelo Ngwenya

I have gridview that is populated by jquery. Below is part of my code thats giving the above error:

我有由 jquery 填充的 gridview。以下是我的代码的一部分,给出了上述错误:

var codes = $(this).find("Code").text();

 $("td", row).eq(6).html($(this).find("oTotal").text());
            if ($(this).find("Stock").text() == 'Y') {

                $("td", row).eq(7).html('<a href="#"  class="tooltip" title="This is my divs tooltip message!" id="' + codes + '" style="text-decoration:none">Y</a>');

                 $('#' + codes).live('click', function () {
                    $('#' + codes).tooltip();

                });
            }
            else {
                $("td", row).eq(7).html($(this).find("Stock").text());
            }

I am getting an error on $('#'+ codes).tooltip(); I have jquery.ui/1.8.22 and jquery/1.8.3.

我在 $('#'+ 代码).tooltip(); 上遇到错误 我有 jquery.ui/1.8.22 和 jquery/1.8.3。

回答by Mister Epic

I think tooltip wasn't part of the file you are pulling in. Are you able to update your CDN reference to jQuery UI to:

我认为工具提示不是您正在拉入的文件的一部分。您是否能够将 CDN 对 jQuery UI 的引用更新为:

http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js

http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js

回答by AkshayK

I solved this problem by moving all my Javascript tags above:

我通过移动上面所有的 Javascript 标签解决了这个问题:

< jdoc:include type="head" />

Hope it works for you too.

希望它也适用于你。

回答by Karthi The Programmer

tooltip()is not a function!!!

tooltip()不是函数!!!

I solved the problem by using below steps in angular 4.

我通过在angular 4 中使用以下步骤解决了这个问题。

install jquery using, npm install jquerycommand.

使用npm install jquery命令安装 jquery 。

add the following code in the path src/typings.d.ts file.

在路径 src/typings.d.ts 文件中添加以下代码。

declare var jquery:any;

interface jquery
{
tooltip(options?:any):any;
}

It solved the tooltip()issue.

它解决了这个tooltip()问题。

回答by Muhammad

The tooltipis the part of Bootstrap so including bootstrap should solve the problem.

tooltip是 Bootstrap 的一部分,因此包含 bootstrap 应该可以解决问题。

Quick links to check with bootstrap, you may remove https:from the beginning of the bootstrap links.

使用引导程序检查快速链接,您可以https:从引导程序链接的开头删除。

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>