简体   繁体   English

jQuery UI选项卡选择选项卡而不触发选择事件

[英]jquery UI tabs select tab without triggering the select event

I'm a complete newb to jquery so sorry in advance if im speaking jibberish. 我是jquery的新手,所以如果我说的是胡言乱语,请提前抱歉。

What I want to do is programatically select a tab in javascript on pageload without triggering the selected event. 我想做的是在页面加载中以编程方式在javascript中选择一个标签,而不会触发所选事件。

The selected event does a postback to the tabitems url, so when I select a tab it just loops postbacks over and over again. 选定的事件会对tabitems网址执行回发,因此,当我选择一个标签时,它只会一遍又一遍地循环回发。

Edit: 编辑:

To clearify, after I click the tab that does a postback, I need to visually represent for the user that the tab is selected, without triggering yet another postback. 为了澄清,在单击执行回发的选项卡后,我需要为用户直观地表示已选中该选项卡,而不会触发另一回发。

try using the select function like this 尝试使用像这样的选择功能

$(document).ready(function () {
    $("#myTabs").tabs("select", 1)
});

This will select the tab at index 1 for the collection of tabs called #myTabs. 这将选择索引1处的选项卡以收集称为#myTabs的选项卡。 Hope this helps. 希望这可以帮助。

I managed to get it working by initializing the selected: attribute instead of using tabs("select",i). 我设法通过初始化selected:属性而不是使用tabs(“ select”,i)使其工作。 I tried it at first as well but it didn't work because of some other circumstances. 我一开始也尝试过,但是由于其他一些情况而没有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM