jQuery livequery - cleanup function firing when it should not?
I have the following code, which is supposed to set the **main_table_on_page** variable according to the actual table presence in the document...

    $('table#main_middle_table').livequery(function() {
        if ($("table#main_middle_table").attr("id")) {
            window.main_table_on_page = true;
        } else {
            window.main_table_on_page = false
        }
    }, function() {
        window.main_table_on_page = false;
    });

... however, the cleanup function (the second one) fires directly after the first function, resulting in **main_table_on_page** being always set to **false**. These functions are fired when I change the content of my main content DIV element (via AJAX), which might or might not contain the table.

Any ideas? :)
jQuery livequery - cleanup function firing when it should not?
===

I have the following code, which is supposed to set the **main_table_on_page** variable according to the actual table presence in the document...

    $('table#main_middle_table').livequery(function() {
        if ($("table#main_middle_table").attr("id")) {
            window.main_table_on_page = true;
        } else {
            window.main_table_on_page = false
        }
    }, function() {
        window.main_table_on_page = false;
    });

... however, the cleanup function (the second one) fires directly after the first function, resulting in **main_table_on_page** being always set to **false**. These functions are fired when I change the content of my main content DIV element (via AJAX), which might or might not contain the table.

Any ideas? :)