Question

Currently I have this code for jQuery tabs

    $(document).ready(function(){
$('.tab-section').hide();
$('.tabs a').bind('click', function(e){
    $('.tabs a.current').removeClass('current');
    $('.tab-section:visible').hide();
    $(this.hash).show();
    $(this).addClass('current');
    e.preventDefault();
}).filter(':first').click();
});

The codes is working when I want to show the first ul a (i.e first link in the list) as per above. Anyone has any idea how do I manipulate the codes if I want to show a specific link in the list instead? Any help is appreciated.

.eq(3).click(); instead of .filter(':first').click(); answered by PXL works thanks

for the second question, is there a way to trigger .filter(':first').click(); inside the .filter(':first').click() instead

Was it helpful?

Solution

You can target any of them with there index -

.eq(3).click(); instead of .filter(':first').click();

Note that .eq(3) will target 4th link as index starts with 0

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top