单击"JQuery UI选项卡"时刷新选项卡内容 [英] Refresh tab content on click in JQuery UI Tabs
本文介绍了单击"JQuery UI选项卡"时刷新选项卡内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
TAB1的内容是由ajax从远程URL加载的.选择TAB1后,我必须切换到TAB2,然后再回到TAB1,以刷新加载的内容.
Content of TAB1 is loaded by ajax from remote url. When TAB1 is selected, I have to switch to TAB2 and then back to TAB1 to refresh the loaded content.
如何在单击TAB1的选项卡时使其刷新已加载的内容?
How to make TAB1 refresh loaded content when click on its tab?
HTML代码如下
<div id="tabs">
<ul>
<li><a href="url1">Tab1</a></li>
<li><a href="url2">Tab2</a></li>
</ul>
</div>
<script type="text/javascript">
$(document).ready(function(){
$tabs = $("#tabs").tabs({
select: function(event, ui) {
$('a', ui.tab).click(function() {
$(ui.panel).load(this.href);
return true;
});
}
});
});
</script>
推荐答案
在jQuery中刷新选项卡的另一种简单方法是使用load方法:
Another simple way to refresh a tab in jQuery is to use the load method:
$('#my_tabs').tabs('load', 0);
数值是您要刷新的选项卡的从零开始的索引.
The numeric value is the zero based index of the tab you wish to refresh.
这篇关于单击"JQuery UI选项卡"时刷新选项卡内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文