Mackelito
Mackelito

Reputation: 4421

Tooltip content qTip2 jQuery

I´m trying to get this to work but it just want...

The alert alerts the correct content.. any ideas?

    function initToolTip() {
        $('.product').qtip({
            content: $(this).find('.product-info').html(),
            style: 'ui-tooltip-shadow'
         });
         $('.product').on('hover',function(){
            //alert($(this).find('.product-info').html());
         });
    }

Upvotes: 0

Views: 558

Answers (1)

Sushanth --
Sushanth --

Reputation: 55750

Here

$(this) is not in the context of the .product in the first case..

$(this) refers to the tooltip object..

Use the custom function to retrieve that ..

$('.product').qtip({
            content: {
               text: function(api) {
                return $(this).find('.product-info').html() ;
               }
            },
            style: 'ui-tooltip-shadow'
         });

Upvotes: 1

Related Questions