[英]How do I switch to another tab from current tab in the application programmatically using javascript and jquery on an event
I am using the tabs of jQuery UI 我正在使用jQuery UI的标签
How do I switch to another tab from current tab in the application pro-grammatically using javascript and jquery on an event eg click of button. 如何在事件(例如单击按钮)上使用javascript和jquery从应用程序的当前选项卡中以编程方式切换到另一个选项卡。
Due to security concerns it is not possible. 出于安全考虑,这是不可能的。 If by "tab" you mean a window and a popup window that opened up in a new tab.
如果使用“选项卡”,则表示在新选项卡中打开的窗口和弹出窗口。
window.opener.focus();
If you want to change to another tab in a Jquery UI tab by programmatically trigger the click event. 如果要通过编程触发click事件更改为Jquery UI选项卡中的另一个选项卡。
$('#id_of_tab').click();
The jQuery UI Tabs use normal links to change the tabs. jQuery UI选项卡使用常规链接来更改选项卡。 So easiest way to change tab is just clicking the link (with javascript/jquery).
因此,更改标签的最简单方法是单击链接(使用javascript / jquery)。 Say the link in your tab has an id like this:
假设标签中的链接具有如下所示的ID:
<div id="tabs">
<ul>
<li><a href="#tabs-1" id="tab-1">Nunc tincidunt</a></li>
<li><a href="#tabs-2" id="tab-2">Proin dolor</a></li>
<li><a href="#tabs-3" id="tab-3">Aenean lacinia</a></li>
</ul>
If you want to change to tab 2 you can use $('#tab-2').click(); 如果要更改为选项卡2,可以使用$('#tab-2')。click();。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.