最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Setting active tab current tab - Stack Overflow

matteradmin6PV0评论

I have three tabs that i'm setting active, due to a certain functionality, the last active tab might not be the one the user on. So at the end of this 3 line code i'm trying to set active the tab that the user is on:

tabPanel.setActiveTab(1);
  tabPanel.setActiveTab(2);
  tabPanel.setActiveTab(0);

I want to set the current tab the tab that the user is on, (the active tab). Any help on this?

I have three tabs that i'm setting active, due to a certain functionality, the last active tab might not be the one the user on. So at the end of this 3 line code i'm trying to set active the tab that the user is on:

tabPanel.setActiveTab(1);
  tabPanel.setActiveTab(2);
  tabPanel.setActiveTab(0);

I want to set the current tab the tab that the user is on, (the active tab). Any help on this?

Share Improve this question edited Jan 18, 2016 at 15:58 mikeb asked Jan 18, 2016 at 15:45 mikebmikeb 7272 gold badges9 silver badges35 bronze badges 6
  • Can you explain it again? question is unclear – Vladimir Commented Jan 18, 2016 at 15:49
  • 1 Can you explain what do you want exactly? Active tab is the one which on which user is currently on. What do you want to set? Framework automatically sets the value for active tab. – Abdul Rehman Yawar Khan Commented Jan 18, 2016 at 15:51
  • @Style i edit the question – mikeb Commented Jan 18, 2016 at 15:58
  • @AbdulRehmanYawarKhan i edit the question – mikeb Commented Jan 18, 2016 at 15:59
  • Maybe you meant enabled? You want set all 3 tabs enabled and set first one active? – Vladimir Commented Jan 18, 2016 at 16:06
 |  Show 1 more ment

1 Answer 1

Reset to default 3

You can do something like this:

var currentTab = tabPanel.getActiveTab();

tabPanel.setActiveTab(0);
tabPanel.setActiveTab(1);
tabPanel.setActiveTab(2);

tabPanel.setActiveTab(currentTab);
Post a comment

comment list (0)

  1. No comments so far