I hope somebody can help me to load the first tab (make it active) when the page is loaded. Now the jquery tabs only works fine after clicking.
I’m using this code:
HTML
<a class="link" href="#" rel="div1">Tab 1</a>
<a class="link" href="#" rel="div2">Tab 2</a>
<div class="content5" id="div1">Content of Tab 1</div>
<div class="content5" id="div2">Content of Tab 2</div>
Javascript/Jquery
$('.link').click(function(e) {
e.preventDefault();
var content = $(this).attr('rel');
$('.active').removeClass('active');
$(this).addClass('active');
$('.content5').hide();
$('#' + content).show();
});
Any ideas?
1 Answer