Stop tabs with query strings from reloading page
I have a set of tabs that are set with an href that adds a query string to the url such as "?t=1", meaning the first tab is selected.
Technically it works just fine but every time I click a tab it reloads the page and I'm not entirely sure how to stop this.
I'm using a jquery plugin to handle the query strings. [url="http://plugins.jquery.com/project/query-object"]Here's the plugin[/url].
Here's the piece of the code that matters:
-
var url = location.search;
var tab = $.query.get('t');
init(tab);
function init(tab){
$("div.tab").hide(); //hides all the content boxes related to the tabs
$("div#tab"+tab).fadeIn("fast"); //Shows the selected tab's content box
setInactive(); //Styles unselected tabs
setActive(tab); //Styles selected tab
}
Any help would be greatly appreciated.