Suppose you have a Menu Block with 3 tabs: MEALS, DRINKS, DINNER.
By default, MEALS will open first when users access the page. But in this post, I will share some steps to change this to tab DINNER.
#1. You need to know this
#2. Use this code to Individual Page Header Code Injection (the page where you use Menu Block)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script> <script> jQuery(document).ready(function($){ setTimeout(function(){ $('label[role="tab"]:nth-child(3)').click(); $('label[role="tab"]:nth-child(3)').addClass('menu-select-labels--active'); $('label[role="tab"]:nth-child(1)').removeClass('menu-select-labels--active'); }, 2000); }) </script>
#3. Note: You will see number 2000 in the code. It means that after the page has finished loading, 2 seconds later the code will start running.
Result: