I found some custom code related to having links become capable of opening up specific tabs. My question is, how can I use this code across multiple links and tabs? For example, if I have 3 links and 3 different tabs, I would like for each link to open up one of the three tabs. Does this code only work 1:1?
<script>
$('.custom-button').on('click', function (evt) {
$('.target-tab-link').triggerHandler('click');
evt.preventDefault();
});
</script>
I understand that my link will get the class element “custom-button” and my tab link will get the class element “target-tab-link”, but if I want my second link to open up my second tab, how do I get the code to have a unique class element so that all links don’t open up the same tab?
For anyone interested in using multiple links to open multiple tabs, you will want to follow the advice of Micah at the following video/URL: Link to Open Tab on Another Page
The caveat here is that the scroll functionality only works across pages, but not if you are linking to tabs within’ the same page. If you are doing this, you will find that you will need to erase the “tab-section” ID you placed (video time 2:20). However, you can add an additional script that will scroll the page down when a link is clicked (like the links of the state).
Please see the attached image with the code.
I would like to thank Gail_Ranger + Micah Johnson in aiding me in this solution. I hope this helps someone in the community!