JQuery UI 选项卡 - 修改选项卡的链接
有没有办法通过 jquery/javascript 修改 jquery ui 中选项卡的链接?
例如,我的页面布局在顶部有一个查询机制,下面有几个选项卡。当用户提交查询时,我想将查询字符串附加到每个选项卡链接。如果我在提交查询时进行全页面刷新,则效果很好,我只需在构建选项卡时将查询字符串插入链接中即可。但是,如果我尝试异步提交并获取结果,我需要更新我的选项卡链接。
下面是我的按钮单击事件的片段,我构建了一个查询字符串,然后像这样提交:
$.ajax({
url: "/MyController/" + actionPrefix + "Index?q=" + query + extraParm + "#ui-tabs-" + selectedTab,
cache: false,
success: function(html) {
$(list).remove();
$(container).append(html);
$('li a.actionLink').unbind('click').click(function() {
//This was some code I was playing with to change tab links, but couldn't seem to get it working...
});
}
});
Is there a way to modify the link to a tab in jquery ui through jquery/javascript?
For example, my page layout has a query mechanism at the top, with several tabs underneath it. When the user submits the query, I'd like append the query string to each of the tab links. This works fine if I do full page refreshes when I submit the query, I just plug the query string in the link as the tabs are being built. However, if I try to submit and get my results asynchronously, I need my tabs links to get updated.
Below is a snippet of my button click event event, I build a query string, then submit it like this:
$.ajax({
url: "/MyController/" + actionPrefix + "Index?q=" + query + extraParm + "#ui-tabs-" + selectedTab,
cache: false,
success: function(html) {
$(list).remove();
$(container).append(html);
$('li a.actionLink').unbind('click').click(function() {
//This was some code I was playing with to change tab links, but couldn't seem to get it working...
});
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
上面的答案在 JQuery 1.9+ 中不起作用作为描述器 此处。要使用 jquery ui tabs 1.9+,您必须执行类似的操作,
这将更改特定索引处选项卡的 URL 并加载该选项卡。
Above answer will not work in JQuery 1.9+ as describer here. To work with jquery ui tabs 1.9+ you have to do something like this
This will change the URL of tab at particular index and load that tab.
href 存储在 .data 存储中。
您可以使用以下命令更改 url
另一种方式查看我对另一个 SO 问题的回答。
从 jQuery-UI 选项卡获取目标 URL
这允许你可以说以下内容来更改第一个选项卡的网址
The href is stored in the .data store.
You can use the following to change the url
Another way see my answer to another SO question.
Getting Target URL from jQuery-UI Tabs
This allows you to say the following to change the first tab url
您应该能够只更改 href:
You should be able to just change the href: