简体   繁体   English

未捕获的类型错误:$(...).tooltip 不是函数错误

[英]Uncaught TypeError: $(...).tooltip is not a function error

I'm trying to use this code with those tooltips.我正在尝试将此代码与这些工具提示一起使用。 In this link: Code with tooltip .在此链接中:带有工具提示的代码 In fact I just copied the whole code but it's now working.事实上,我只是复制了整个代码,但它现在可以工作了。 I get an error that says Uncaught TypeError: $(...).tooltip is not a function error :我收到一条错误消息,指出Uncaught TypeError: $(...).tooltip is not a function error

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">

<script>
  $(function() {
    $(document).tooltip({
      position: {
        my: "center bottom-20",
        at: "center top",
        using: function(position, feedback) {
          $(this).css(position);
          $("<div>")
            .addClass("arrow")
            .addClass(feedback.vertical)
            .addClass(feedback.horizontal)
            .appendTo(this);
        }
      }
    });
  });
</script>

What is missing here?这里缺少什么?

Edit:编辑:

<script>
jQuery( document ).ready(function( $ ) {
   $('.hasTooltip').tooltip();
});
</script>

Using it like this, solved my problem!像这样使用它,解决了我的问题!

You are including two times the jQuery UI for different versions.您为不同版本包含了两倍的 jQuery UI。 This might be causing conflicts.这可能会导致冲突。 Try removing尝试删除

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>

You are getting the error because jquery-ui is loaded after your script is executed.您收到错误是因为在执行脚本后加载了 jquery-ui。 you can try to add type="text/javascript" to your scripts normally this must resolve the issue or you must wait until the script is loaded to execute your tooltip.您可以尝试将 type="text/javascript" 添加到您的脚本中,通常这必须解决问题,或者您必须等到脚本加载后才能执行您的工具提示。 so you must creat a function that will execute your script after the jquery-ui is loaded.所以你必须创建一个函数,在加载 jquery-ui 后执行你的脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未捕获的类型错误:$(...).tooltip 不是函数 - Uncaught TypeError: $(…).tooltip is not a function Rails Webpacker - 未捕获的类型错误:$(...).tooltip 不是 function - Rails Webpacker - Uncaught TypeError: $(…).tooltip is not a function kendo-chart-tooltip 生成脚本错误 Uncaught TypeError: background.isDark is not a function - kendo-chart-tooltip generating script error Uncaught TypeError: background.isDark is not a function Highchart未捕获的错误-Uncaught TypeError:$(…).highcharts不是函数 - Highchart uncaught error - Uncaught TypeError: $(…).highcharts is not a function 未捕获的TypeError:$ .ajax(...)。error不是函数 - Uncaught TypeError: $.ajax(…).error is not a function 错误“未捕获的TypeError:$(...)。datetimepicker不是函数” - Error “Uncaught TypeError: $(…).datetimepicker is not a function” jQuery 错误:未捕获的类型错误:$ 不是函数 - jQuery Error: Uncaught TypeError: $ is not a function 错误:未捕获的类型错误:未定义不是函数 - Error: Uncaught TypeError: undefined is not a function 未捕获的类型错误:$(...).fullCalendar 不是 function 错误 - Uncaught TypeError: $(…).fullCalendar is not a function error 未捕获的类型错误:$(...).tooltip 不是 Laravel 应用程序中的函数(Bootstrap 4 预设) - Uncaught TypeError: $(…).tooltip is not a function in Laravel application (Bootstrap 4 preset)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM