tags:

views:

55

answers:

0

EDIT I should say I am calling the method twice that is why there are 2 messages but I'd like to be able to check if there are any esiting messages assigned and then delete them before assigning the new ones

Hi I am using the qtip plugin and I have 2 tips assigned to the one div. I would like to be able to remove the old one and then add the new one. Instead the new one is on top of the old one but I can't see anywhere in the api reference the ability to remove a tool tip....the following code I have sitting in a common js file

this.addToolTip = function(elementId, message){



        var _corner;
        var _target;
        var _tip;
        if($("#"+elementId).is(':radio') || $("#"+elementId).is(':checkbox'))
        {
        _corner='bottomMiddle'
        _target='topMiddle'
        _tip = 'bottomMiddle'
        }
        else
        {
        _corner='leftMiddle'
        _target = 'rightMiddle'
        _tip = 'leftMiddle'
        }

    $("#"+elementId).qtip({
    content: message,
        position:{corner:{tooltip:_corner,target:_target}},
        style: {
            tip: {corner: _tip, size: {x:10, y:10}},
            name: 'green',
            border:{width:2, radius:5}
        }
    });

    };

I tried the following but didn't do anything

    $("#"+elementId).qtip({
        content: ""}
    );

I also tried which didn't work. Any ideas?

$("#"+elementId).qtip("destroy"); // Destroys the tooltip