10

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

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.

5
  • What you exactly need one..? Commented Aug 16, 2013 at 18:23
  • 1
    Are you certain that you included the tooltip component in your jquery UI loadout? Commented Aug 16, 2013 at 18:23
  • Yes I did. I used this CDN ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/jquery-ui.js Commented Aug 16, 2013 at 18:25
  • 1
    Can you provide the link to the CDN? Commented Aug 16, 2013 at 18:29
  • I searched through the file, tooltip is not in it. Commented Aug 16, 2013 at 18:35

6 Answers 6

19

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:

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

Sign up to request clarification or add additional context in comments.

Comments

3

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

< jdoc:include type="head" />

Hope it works for you too.

Comments

1

Try re-arranging your script includes so jQuery is first, jQuery UI is second, then along through the rest.

Comments

0

tooltip() is not a function!!!

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

install jquery using, npm install jquery command.

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

declare var jquery:any;

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

It solved the tooltip() issue.

Comments

0

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

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

<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>

Comments

0

tooltip() has not always existed in jQuery UI. It was added in version 1.9, so it'll work in any version after 1.9. Proof:

version added: 1.9 (Source: API.jQueryUI.com: Tooltip Widget.)

If you don't have a version of jQuery UI at version 1.9 or higher, you'll get the error: tooltip() is not a function().

This is why the accepted answer works: it simply links to version 1.10.3. Ideally, you should be using the most modern version of jQuery UI available (in fact, this rule applies typically to all packages).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.