I have a link with the class .deleteLink I’d like to be able to know when only 1 of this elements remain and when that happens hide that anchor. I don’t think I have a good idea of how to do this though so far this is what I’ve got:
$('.deleteLink').click(function(){
var $deletes = $('.deleteLink');
$deletes.each(function(index){
alert(index + " : " + $(this).attr('class'));
});
});
EDIT
I forgot to say that those links are being created via another anchor (#addLink) so I had trouble to get ahold of them until I changed the code to :
$('.deleteLink').live('click', function(){
still when I want to hide or remove the last .deleteLink nothing is affected.
Try this:
});