开发者

jQuery tooltip is not working

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" languag开发者_如何学编程e="javascript" src="mainscript.js"></script>

I'd appreciate some help.

UPDATE: removing mouseover doesn't help


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~


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜