开发者

How to force 'select' event in jQuery Tabs if tab already selected?

The main issue is that if tab is already selected the 'select' event doesn't fire if i set the same tab id again. The reason i required in this to update the content located in the tab. I need a way to fire 'select' even if i specify already selected tab id.

In theory this should work Something like:

tabControl.tabs('select', -1);
tabControl.tabs('select', selectedTab);

but 'select' takes zero based index, so it doesn't reset tabs开发者_StackOverflow中文版 as desired and doesn't raise event again.

Any solution?


I wouldn't recommend selecting tab twice just because you need to reload its contents. Instead I solved same issue by calling the tabs() 'load' method instead of 'select'.

var selectedTab = tabControl.tabs('option', 'selected');
tabControl.tabs('load', selectedTab);


If you have the selected tab object (selectedTab), try to call the event directly with something like:

selectedTab.select();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜