Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
584 views
in Technique[技术] by (71.8m points)

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

I'm trying to make sense of how cluetip actually works. I have a dummy DOM structure which I did some alerts on to check if the cluetip has been removed after the cluetip('destroy') was called on the anchor element. However, the cluetip div still appears to be alive and well. This really confuses me...

Correct me if I'm wrong... AFAIK, cluetip has 1 instance in the webpage, and it exists in a hierarchy of tags, i.e. cluetip > cluetip-outer > cluetip-inner. It appends itself somewhere to the DOM structure when it is first appended to a html element (in my case, an anchor).

So the question: would calling cluetip('destroy') on the html element actually remove the cluetip, or would it remove/reset some sort of variable in the cluetip (and if so, which variable)? Or am I totally off the track here?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try the following:

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

The remove() function should also unbind the events.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...