带有Primefaces的jQuery Tooltip:未捕获的TypeError:$(...).tooltip不是函数 [英] JQuery Tooltip with Primefaces: Uncaught TypeError: $(...).tooltip is not a function

查看:137
本文介绍了带有Primefaces的jQuery Tooltip:未捕获的TypeError:$(...).tooltip不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在使用Primefaces的JSF应用程序中使用jQuery Tooltip(因此,Primefaces自动加载jQuery),但是出现以下错误:

I'm trying to use a jQuery Tooltip in a JSF application where I use Primefaces (so, jQuery is automatically loaded by Primefaces), but I get the following error:

未捕获的TypeError:$(...).tooltip不是函数

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

我以这种方式使用工具提示功能:

I use the tooltip function in this way:

<script type="text/javascript">

        // DOM Ready
        $(function() {

        //jQuery Tooltip
         $( document ).tooltip();
    });

    </script>

更新

如果我手动"包含jquery-ui,则可以使用:

If I "manual" include jquery-ui it works:

<h:outputScript name="scripts/jquery/jquery-ui.min.js"/>


PF 6.0(使用jQuery v1.11.3) WildFly 10


PF 6.0 (with jQuery v1.11.3) WildFly 10

推荐答案

工具提示是jquery ui的一部分,而不是jquery的一部分(请参阅

tooltip is part of jquery ui, but not of jquery (look here for differences). PrimeFaces uses jQuery, but only parts of jquery ui. tooltip is not part of it. So you can't use tooltip with PrimeFaces only. You have to load it yourself like you did in your question. But be careful that you choose a jquery ui version that is compatible with PrimeFaces' jquery version.

这篇关于带有Primefaces的jQuery Tooltip:未捕获的TypeError:$(...).tooltip不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆