Okay
  Public Ticket #1853935
Tab link inside of the same page
Closed

Comments

  • alebeta started the conversation

    Hello friends,

    I want to create a button that link to a tab. In this case, everything is happening in the same page, for that reason using, ?tab=tab_name does not work for me, because such action will reload page where the client is. I had been trying to use #tab-ID tag, the same as is used for the tab widget, but is not working if I added in my custom button. there is a way to do so??


    thanks and all the best

  •  3,030
    Andrew replied

    Hi,

    Thank you for contacting us.

    If you would like to open a tab from the tab widget using a button you would need some custom javascript and example of this would be. You can add it to your page using a RawJS widget.

    <script>
    jQuery(function($) {
         $('a.nectar-button[href*="#tab-"]').click(function() {
              var tab = $(this).attr('href').replace("#tab-", "");
              $('.ui-tabs-nav li:eq(' + tab + ') a').trigger("click");
         });
    });
    </script>
    

    For the btn link just set #tab-number like in the image below.

    1856967955.jpg

    Based on the number it will open a specific tab, meaning from left to right it would be 0,1,2.

    Kind Regards

  • alebeta replied

    Hello Andrew,


    thank you very much for your help! the script did the job!


    All the best