any one can explain me how this filter(‘:first’).click() working?
$(function() {
var tabContainers = $('div.tabs > div');
tabContainers.hide().filter(':first').show();
$('div.tabs ul.tabNavigation a').click(function() {
tabContainers.hide();
tabContainers.filter(this.hash).show();
$('div.tabs ul.tabNavigation a').removeClass('selected');
$(this).addClass('selected');
return false;
}).filter(':first').click();
});
It’s like this:
when you click on
div.tabs ul.tabNavigation a. the click function defined just after the$('div.tabs ul.tabNavigation a')in your code will be executed. and moreover since you added another click i.efilter(':first').click();, the click function executed earlier, will be executed again forfirstul a (i.e first link in the list)