I've got a function that handles various types of behaviour for a property listing (My Shortlist) which is a <ul><li> setup. One type of behaviour is removing a property listing item <li> when you click a button within each item, that's working fine however my if statement to check when all items have been removed isn't working.
Can you tell me what I'm doing wrong? Here's the part of the function that handles removing items via the onclick event of the button and the dodgy if statement:
// Remove an item from the shortlist
$(this).find('.btn-minus').click(function() {
    var btnRemove = $(this);
    var propTile = $(this).parents('.property-tile');
    var propList = $('#property-listings');
    // If IE 8 / 7
    if ($('html').hasClass('lte8')) {
        propTile.hide('slide', 300, function()  {
            btnRemove.data("tooltip").hide();
        });
    }
    // All other browsers
    else {
        propTile.fadeOut(200, function()  {
            btnRemove.data("tooltip").hide();
            $(this).remove();
        }); 
    }
    if (propTile.length === 0) {
        propList.remove();
    }
});
And here's the call to the function: $(".my-shortlist").myShortlist(); where .my-shortlist is the <ul> element.
Thanks
 
     
     
    
`.
– crite Jun 05 '12 at 10:20