我正在使用以下代码作为选项卡插件:
我的HTML页面包含4个列表项作为菜单。当页面刷新时,它总是会加载第一个元素的内容,如代码中所示。每个li链接到具有各自表单的div。如果我在action表单中调用同一页面,如何加载相应的内容。这意味着如果我提交了搜索租金表单,那么当页面刷新时,它应该显示搜索租金容器,而不是li:first。
//When page loads...
$("#searchbox .tab_content").hide(); //Hide all content
$("#searchbox ul.tabs li:first").addClass("active").show(); //Activate first tab
$("#searchbox .tab_content:first").show(); //Show first tab content
//alert($("ul.tabs li:last").find("a").attr("href"));
//On Click Event
$("#searchbox ul.tabs li").click(function() {
$("#searchbox ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$("#searchbox .tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
我的HTML页面包含4个列表项作为菜单。当页面刷新时,它总是会加载第一个元素的内容,如代码中所示。每个li链接到具有各自表单的div。如果我在action表单中调用同一页面,如何加载相应的内容。这意味着如果我提交了搜索租金表单,那么当页面刷新时,它应该显示搜索租金容器,而不是li:first。