我正在使用jquery選項卡和以下js方法,如何以及我可以修改它以維護回發之間的選項卡狀態? (這Page_Load中之後重置選項卡,第一個選項卡)jquery回發,回發後保持相同的選項卡
$(document).ready(function() {
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".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;
});
我用更新面板不會導致回發。 – 2010-02-01 20:16:23
我還使用了隱藏字段來跟蹤選定的標籤。有用。 – 2010-03-17 23:20:18
我用更新面板..但是當我做一個按鈕點擊第二個選項卡時,回發導致顯示第一個選項卡...爲什麼? – Muhammedh 2014-08-04 09:53:57