Reputation: 25
I am using following code for a particular page on which i want the tabs(course descriptions and other version) to be clicked and show contents during the page load but it is not working...here is the code with the link of the page:
window.onload=function() {
init();
function init() {
var tabLink = getFirstChildWithTagName( tabListItems[i], 'A' );
var id = getHash( tabLink.getAttribute('href') );
tabLinks[id] = tabLink;
contentDivs[id] = document.getElementById( id );
var i = 0;
for ( var id in tabLinks ) {
tabLinks[id].onclick = showTab;
tabLinks[id].onfocus = function() { this.blur() };
if ( i == 0 ) tabLinks[id].className = 'selected';
i++;
}
}
}
But i am little bit confused in syntax part. the tabs are only able to show contents when the entire page loads. but i need to show the content when user clicks on tabs during please loading.
Upvotes: 0
Views: 196
Reputation: 4489
Hi You can do this as given below
$("document").ready(function() {
setTimeout(function() {
var tabLink = getFirstChildWithTagName( tabListItems[i], 'A' );
var id = getHash( tabLink.getAttribute('href') );
$("id").trigger('click');
},10);
});
Hope it helps you
Upvotes: 1