2011-12-22 46 views
0

我遇到了ajax .tabs()問題,並且清空或刪除了未選中的選項卡的內容。我搜索了jQuery的網站,發現該事件,但至於接下來會發生什麼很困惑:如何在新選項卡上清空未選中的ajax .tabs()選擇

$(".selector").bind("tabsselect", function(event, ui) { 

    // All other tabs need to be empty when the new tab is selected 
    // Before the selected tab is loaded (ajax) 

}); 

任何人都可以在這方面幫助?

回答

0

呼叫使用適當的selector將它應用到所有標籤頁的jQuery .empty()方法:

$(".selector").bind("tabsselect", function(event, ui) { 
    // All other tabs need to be empty when the new tab is selected 
    // Before the selected tab is loaded (ajax) 

    $("a selector for your tabs").empty(); 

    // ajax to populate the selected tab here 
}); 

在哪裏,我說:「你的選項卡的選擇」你只需要把自己的selector適當 - 可能是「.selector」,從你展示的代碼片段開始,但沒有看到你的HTML,我不知道。

(注意:清除包含所選標籤的所有標籤應該沒問題,因爲在這樣做之後,您將重新填充剛選擇的標籤)

相關問題