I have 16 <li>
items.
Upon clicking a button, I run the following code which removes a <li>
item.
jQuery('.btnRemoveItem').live("click",function(){
var obj = this;
jQuery.post("wp-content/themes/storelocator/include/adm_gallery.php", { deleteImage: 'single', name: jQuery(this).attr('id') },
function(data){
if(data.status == 'deleted');
{
jQuery(obj).closest('li').fadeOut(400, function() { $(this).remove(); });
var count = jQuery('#adminGallery ul li').length;
jQuery('#imageCount').html(count);
}
}, "json");
});
This code works and removes the list item. However, doing a item count, still returns 16 items.
I therefore need to bind the event somehow. I thought maybe that $.live
would help, but it has no effect.
How should I go around to "bind" the <li>
removal?