I wonder if we can able to select a particular tab in a JQuery tab system from another page..?
For example I have a 4 menus that is Home | About | Services | Contac
(I've made a 'fiddle' on jsFiddle so you can test this answer.)
You code was almost correct; it seems that a few HTML errors may have been the cause. Assuming our HTML looks like:
1
2
3
4
5
... our JavaScript should be:
$(document).ready(function() {
//When page loads, hide all content
$(".tab_content").hide();
$(".tab_content:first").show(); //Show first tab content
$("#tabs li:first").addClass("active").show(); //Activate first tab
//On Click Event
$("#tabs a").click(function() {
//Remove any "active" class
$("#tabs .active").removeClass("active");
//Add "active" class to selected tab
$(this).parent().addClass("active");
// Hide all tab content
$(".tab_content").hide();
//Find the href attribute value to identify the active tab + content
var a = $(this).attr("href");
//Fade in the active ID content
$(a).fadeIn();
return false;
});
});