1

I want a tooltip to show when I rollover on particular links. It's not working. The commented out alert is working, so event is not the issue. This is my javascript code:

$(window).load( function() {

$("a").each(function() {
    if(this.text==" View image") {

        $(this).mouseover(function() {
//              alert("blabla");
            $(this).tooltip();
        });

    }

});

});

on my html file the includes are:

<script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" language="javascript" src="jquery.tooltip.min.js"></script>
<script type="text/javascript" language="javascript" src="mainscript.js"></script>

I'd appreciate some help.

UPDATE: removing mouseover doesn't help

Caballero
  • 11,546
  • 22
  • 103
  • 163

3 Answers3

1

Remove the mouseover function. The plugin doesn't require you to add a custom mouseover function. It's done from the plugin for you.

if(this.text==" View image") {
            $(this).tooltip();
    }

Hope this helps ^^

Change the main jQuery function to $(document).ready(function(){});

This will probably work now~

Chan
  • 2,601
  • 6
  • 28
  • 45
  • To find more ways to use this plugin refer the demos - http://jquery.bassistance.de/tooltip/demo/ – Chan Aug 04 '11 at 11:58
0

Try this:

$("a").each(function() {
    if(this.innerHTML == " View image") {
        $(this).tooltip();
    }
}

Also, there's a space before the View in "View image". I'm not sure if that's intentional or not.

tskuzzy
  • 35,812
  • 14
  • 73
  • 140
0

I used jQuery tipsy on my recent projects. Quite easy to understand and integrate.

Arda
  • 6,756
  • 3
  • 47
  • 67