Skip to content
Advertisement

Button not showing selected on tab load from jquery

When I load the page normally, it will display corrected. However when attempting to load the tab through the url IE: page.php#tab2, the tab navigation will not select the tab I am currently on and will instead load the default tab “tab1”

jquery:

JavaScript

html:

JavaScript

What it’s doing… https://i.stack.imgur.com/40Tc5.png

What I want it to do… https://i.stack.imgur.com/O8Fit.png

Navigation:

JavaScript

Advertisement

Answer

Since you are doing the same thing twice, it’s good practice to consolidate into a single function. Doing it that way can also help find errors since you have to look in one place instead of 2 or more

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement