Skip to content
This repository has been archived by the owner on Aug 6, 2019. It is now read-only.

Useful Snippet: How to detect which tab (by name) you are on. #232

Open
samjco opened this issue Nov 21, 2018 · 0 comments
Open

Useful Snippet: How to detect which tab (by name) you are on. #232

samjco opened this issue Nov 21, 2018 · 0 comments

Comments

@samjco
Copy link

samjco commented Nov 21, 2018

$('#rootwizard').bootstrapWizard({onTabShow: function(tab, navigation, index){

var currTabURL = tab.context.toString(),
      getFullUrl = window.location;

// current tab with url
console.log('current tab url= '+currTabURL);
// current full url
console.log('complete url= '+getFullUrl);
// just the current tab
var currTab = currTabURL.replace(getFullUrl, "");
console.log('just the tab= '+currTab);

// Then you can do something like:
 if (currTab == '#your-tab-name'){
  //do something
 }else(
  //do something
 }

}}); 
@samjco samjco changed the title Useful Snippet: How to detect which tab you are on. Useful Snippet: How to detect which tab (by name) you are on. Nov 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant