Friends, how to do that if you move from another page to a new page (and there are tabs on it) and that a certain tab open automatically?

  • You need to remember the last open tab. - Vfvtnjd
  • how to remember it if we were not there yet? For example, there are 7 tabs and I know for sure that I need to go and open the 4th, how? may need to pass some parameter? - oldzas
  • See the answers @ Shrek, @ Kal1sha. If the first time we open the page, then we take the default value. And then just remember the last tab (write in cookies or sessions). You have on what? On [bootstrap] [1]? Or jQueri UI? [1]: - Vfvtnjd

3 answers 3


where n is the number of the tab.

    By default, the 4th tab is assigned a value of open and all.

      The normal way, which is described in the documentation :

       $('#myTab li:eq(2) a').tab('show'); // Select third tab (0-indexed) 

      the way I used because For reasons already forgotten, the first method did not work:

       $('#myTab').find('li').removeClass('active').eq(3).addClass('active'); $('#myTabContent').find('.tab-pane').removeClass('active in').eq(3).addClass('active in'); 

      3 in .eq(3) - the number of the fourth taba