$(…).tooltip is not working since jQuery 1.9.2 is

2019-08-09 03:14发布

问题:

I'm working on a website which is built in some heavy PHP framework.

So it already has included jQuery UI 1.8.16 library. Now I have to implement $(...).tooltip functionality on one web page. This feature is not availabe in jQuery UI 1.8.16 but it is available in jQuery 1.9.2 .

<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>

So I included following line into the HTML file where I want to implement the $(...).tooltip functionality. But still in firebug I got following error:

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

How to resolve this issue? Can someone please help me in this regard?

回答1:

You can download only Tooltip widget from jQuery UI - Download Builder.

To build a custom jQuery UI library, check the following items:

  • UI Core

    1. Core
    2. Widget
    3. Position
  • Widgets

    1. Tooltip
  • Theme (optionl)

Then load JS library after jQuery core as well as stylesheets.

After that you can simply initialize the widget.

$( "#tooltip" ).tooltip();

Here is a working example.