jQuery cluetip('destroy') does not destroy/remove cluetip?

旧时模样 提交于 2019-11-29 15:09:15

It looks like all the destroy function does is remove the event trigger (lines 28-30)

if (js == 'destroy') {
  return this.unbind('.cluetip');
}

If you want to ensure the data in the cluetip is gone, then clear it yourself:

$('#cluetip-inner').empty();

Update: To answer your question about seeing if an element has anything bound to it, I'll refer you to something I found from James Padolsey's site:

// List bound events:
console.dir( jQuery('#elem').data('events') );

// Log ALL handlers for ALL events:
jQuery.each($('#elem').data('events'), function(i, event){
    jQuery.each(event, function(i, handler){
        console.log( handler.toString() );
    });
});

*Note: the console is referring to the Firebug console.

Try the following:

$(this).cluetip('destroy'); 
$(this).remove(); 

The remove() function should also unbind the events.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!