Tabs clicked/selected with javascrip instead of HTML?

Hi there, I have implemented the tabs from the documentation of Framework7 Core. I am trying the following. When I click on a button, a function will be executed and based on the outcome of the function I want to select the next tab which is tab 2 href="#tab-2" in HTML. My question is if it is possible to go to tab-2 by use of javascript instead of href="#tab-2" and direct going to the tab. Because now there is no check if it should allow to go further to tab 2 or not. Or maybe there is another way to do and someone may want to explain to me? Thanks in advance!

Kind regards,

Ono

You can use Tabs api for that https://framework7.io/docs/tabs.html#tabs-app-methods