如何卸载隐藏/不活动的jquery ui标签?

我在我的asp.net mvc Web应用程序中使用Jquery UI选项卡。

我总共有6个标签。 每个选项卡都包含用户控件。

我正在使用像这样的ajax将内容动态加载到每个选项卡中:

  • <a href="https://stackoverflow.com/questions/19860422/how-to-unload-jquery-ui-tabs-that-are-hidden-not-active/"> Tab
  • <a href="https://stackoverflow.com/questions/19860422/how-to-unload-jquery-ui-tabs-that-are-hidden-not-active/"> Tab1
  • <a href="https://stackoverflow.com/questions/19860422/how-to-unload-jquery-ui-tabs-that-are-hidden-not-active/"> Tab2
  • <a href="https://stackoverflow.com/questions/19860422/how-to-unload-jquery-ui-tabs-that-are-hidden-not-active/"> Tab3
  • <a href="https://stackoverflow.com/questions/19860422/how-to-unload-jquery-ui-tabs-that-are-hidden-not-active/"> Tab4
  • <a href="https://stackoverflow.com/questions/19860422/how-to-unload-jquery-ui-tabs-that-are-hidden-not-active/"> Tab5

可以看出,标签2到标签6包含相同的用户控件。 将根据单击的选项卡加载数据。

在这里,我的问题是一旦加载选项卡,单击另一个选项卡,其他选项卡内容只是隐藏。

因为,我使用相同的用户控件,我面临一些问题。

所以,我想删除隐藏(非活动)标签中的内容

请帮忙..

您可以使用插件中的activate事件清除上一个选项卡的内容。 试试这个:

 $('#tabs').tabs({ activate: function(event, ui) { ui.oldPanel.empty(); // clear the content of the previous tab } // other settings, if needed... });