briancray / tooltipsy

Introducing a jQuery tooltip plugin for control-obsessed designers.
http://tooltipsy.com
MIT License
325 stars 97 forks source link

Provide way to destroy tooltip #8

Closed benkutil closed 13 years ago

benkutil commented 13 years ago

Is there a way to destroy a tooltip? If not, that would be a helpful method to have access too.

benkutil commented 13 years ago

Sorry, I didn't see the closed issues.

Here’s the specific use case why I’d like to destroy tool tips.

I‘m using them to show error validations, and checking validations. When a form becomes valid, I want the tooltip to update to be the valid text. Easiest way I see to do it with this plugin is to delete the current tooltip and create a new one with the valid text in it.

briancray commented 13 years ago

with tooltipsy as the class name of the original selector...

$('.tooltipsy').data('tooltipsy').$tip.html('new content');

deleting/recreating tooltips is unnecessary cycles. This will allow you to change the content without any DOM manipulation

rcherny commented 13 years ago

I need to do the same thing benkutil mentioned. except i don't need to update it. the field with the error gets a tooltip and when it's corrected the tooltip is removed. any easy way to do that? looking for an "unbind" or clear type thing ... can we remove the .data() or something?

abuisman commented 13 years ago

Hello, first of all thanks for the plugin, but I am having some issues with it. Mostly, I want to destroy it, like has been suggested.

chrisjacob commented 13 years ago

+1 for "destory" options. I'm looking to implement tooltips for error messages dynamically generated by the jQuery Validation plugin. When the field has an error that error is shown in the tooltip (on hovering over the input). Once the field is valid the tooltip should be destroyed.

http://bassistance.de/jquery-plugins/jquery-plugin-validation/

I think this is a pretty popular use case for tooltips.

briancray commented 13 years ago

Will add a destroy option.

briancray commented 13 years ago

Added a destroy method, but since Lion removed git I'm waiting for Xcode to install. But the update's coming soon!

briancray commented 13 years ago

Added method in new commit: $('.hastip').data('tooltip').destroy(); where .hastip is the original selector.

lucianosantos commented 12 years ago

There is some problem about destroying. When you call the destroy function, it destroys the $tipsy, but when I destroy a tooltip that hasn't been shown yet, that var is undefined, causing an error and not unbinding the data from the element.

briancray commented 12 years ago

I'll check it out

zkwentz commented 11 years ago

I'll check it out

Any word on this?

briancray commented 11 years ago

Fixed :)