Consider the following jquery:
$('.entry-links:not(.entry-links-processed)').each(function(){
$(this).addClass('entry-links-processed');
$('li a', this).click(function(event){
$target = $(event.target);
var tabPics = $('#tab-pics>a');
if($target === tabPics){
tabTest.getPics();
}
$('.entry-links li a').removeClass('active');
$(this).addClass('active');
var id = $(this).attr('href');
$('.entry-box:not(' + id + ')').hide();
$(id).show();
return false;
});
});
I have three tabs or menu items: when you click on one, this code will hide the content portion of the others.
Out of this, the following portion is the focus of this question:
$target = $(event.target);
var tabPics = $('#tab-pics>a');
if($target === tabPics){
tabTest.getPics();
}
As the code snippet shows, I'm trying to call a function when the pictures tab is clicked. Following my code using breakpoints, I see that I'm capturing the $target successfully and yet, even though it matches tabPics, the function call is skipped and the rest of the code runs normally.
If I have matched the $target and tabPics, why would it skip over the function call when I've met the condition in my if statement?
Thanks for the help.