I am working on a project, where I want to show a second tab active on window load, but it always active the first tab.
Here is my script:
<script>
$(document).ready(function() {
$('#tabs div').hide();
$('#tabs div:first').show();
$('#tabs ul li:first').addClass('active');
$('#tabs ul li a').click(function() {
$('#tabs ul li').removeClass('active');
$(this).parent().addClass('active');
var currentTab = $(this).attr('href');
$('#tabs div').hide();
$(currentTab).show();
return false;
});
});
</script>
The problem is, when I write second in place of first it doesn't work.
$('#tabs ul li').eq(1).addClass('active')instead$('#tabs div').eq(1).show();