tags:

views:

24

answers:

1

Hi,

I am using the jQuery qTip plugin and am having trouble loading html content into it from another element.

I have the following code:

$('.tip').qtip({
    content: { 
        text: $(this).next('.product_info').html() 
    }
});

with the following html:

<a href="#" class="tip">An Image</a>
<div class="product_info">Some content</div>

The problem is that I cannot seem to use "$(this)" so how can I refer to the current ".tip"?

Thanks!

+1  A: 

i think this question's answer will answer this for you: http://stackoverflow.com/questions/3290685/qtip-jquery-plugin-to-display-text-from-link

basically you need to loop through your things to tip and then tip then individually and this will work;

$('.tip').each(function(){
    $(this).qtip({
        content: { 
            text: $(this).next('.product_info').html() 
        }
     });
});
Patricia