Home > OS >  How can I get my vertical tab button to switch tabs properly?
How can I get my vertical tab button to switch tabs properly?

Time:09-27

I am trying to get the vertical tab buttons under the 'My Rooms' main tab to switch properly, but i get a styling error and this error code:

Uncaught TypeError: Cannot read properties of null (reading 'classList') at HTMLAnchorElement. (settings.js:85:27) at settings.js:106:63 at NodeList.forEach () at HTMLDocument. (settings.js:104:48) 6settings.js:85 Uncaught TypeError: Cannot read properties of null (reading 'classList') at HTMLAnchorElement. (settings.js:85:27)

How can I fix this?

I have provided the snippet link file below in the comments. The minimum reproducible code is too big for the snippet. Please check it out. It will take two seconds, I don't have that much JS. Thanks!

CodePudding user response:

Because the structure of .tab-button and .vtab-button are different in your HTML. For .tab-button, you can jump twice to responsive wrapper, but for .vtab-button you need to jump three times to content main wrapper. Add another parentElement call to clear the error.

const menuBar = link.parentElement;
const menuTab = menuBar.parentElement; // to add
const tabsContainer = menuTab.parentElement;
  • Related