jQuery tooltip: Trouble with remove()

Posted by Rosarch on Stack Overflow See other posts from Stack Overflow or by Rosarch
Published on 2010-05-15T02:03:44Z Indexed on 2010/05/15 2:14 UTC
Read the original article Hit count: 292

Filed under:
|
|
|

I'm using a jQuery tooltip plugin.

I have HTML like this:

<li class="term ui-droppable">
    <strong>Fall 2011</strong>
    <li class="course ui-draggable">Biological Statistics I<a class="remove-course-button" href="">[X]</a></li>
    <div class="term-meta-data">
         <p class="total-credits too-few-credits">Total credits: 3</p>
         <p class="median-GPA low-GPA">Median Historical GPA:  2.00</p>
    </div>
</li>

I want to remove the .course element. So, I attach a click handler to the <a>:

function _addDeleteButton(course, term) {
    var delete_button = $('<a href="" class="remove-course-button" title="Remove this course">[X]</a>');
    course.append(delete_button);

    $(delete_button).click(function() {
        course.remove();
        return false;
    }).tooltip();
}

This all works fine, in terms of attaching the click handler. However, when course.remove() is called, Firebug reports an error in tooltip.js:

Line 282
tsettings is null

if ((!IE || !$.fn.bgiframe) && tsettings.fade) {

What am I doing wrong? If the link has a tooltip attached, do I need to remove it specially?

UPDATE: Removing .tooltip() solve the problem. I'd like to keep it in, but that makes me suspect that my use of .tooltip() is incorrect here.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-tooltip