JQuery Tooltip with Primefaces: Uncaught TypeError: $(…).tooltip is not a function [duplicate]

会有一股神秘感。 提交于 2019-12-12 03:58:14

问题


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:

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>

UPDATE

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

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

PF 6.0 (with jQuery v1.11.3) WildFly 10


回答1:


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.



来源:https://stackoverflow.com/questions/42417203/jquery-tooltip-with-primefaces-uncaught-typeerror-tooltip-is-not-a-func

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