Streaming live at 10am (PST)

JS Button Active with Tabs

Hey guys,

I am trying to get my button to remain active when the user switches between tabs (created natively in Webflow).

I have used the following for when the page loads but if I start in a different tab and then toggle over, the button background color doesn’t stay on focus.

<script> document.getElementById('focusmeplease').focus();

Any ideas?


That’s because when the user clicks, everything else is “un-focused”. What are you trying to accomplish with this?

My entire site is only one page and I have a tab bar navigation in my header.

The button is on the third tab so the user has to click the third tab before the button and JS for it is displayed.

My question is, how to I keep the button focused and active the entire time the user is on the page no matter what tab they switch to/ start on?

I’m asking why you need this button focused?

I have an isotope filter on some CMS content. When my initial page is not the tab where the isotope list is on the button loses its focus when I selected the tab:

However if I make that tab the initial tab everything works fine and the list displays nicely.

There are two simple ways,

  1. Only use the plugin on the initial tab

  2. Do not use tabs for navigation