1

It seems that the Visual Composer Tab is not allowing the Custom JavaScript to perform its function when page is reloaded/refresh.

My goal is to select same tab as the page reloads or refresh due a form submits a data on one tab.

I got this code:

var $j = jQuery.noConflict();

$j('.wpb_tabs_nav li a').click(function(){
    var hrefs = $j(".wpb_tabs_nav .active-tab").attr("href");
    localStorage.setItem("link", hrefs);
    var links = localStorage.getItem("link");
    console.log(".wpb_tabs_nav li a[href='"+ links +"']");
});

$j( document ).ready(function() {
    var links = localStorage.getItem("link");
    console.log(".wpb_tabs_nav li a[href='"+ links +"']");
    $j(".wpb_tabs_nav li a[href*='"+ links +"']").addClass('active-tab');
    $j(".wpb_tabs_nav li a[href*='"+ links +"']").click();
});

if this code is on the page the first load I can see it selects right but I automatically jump into the first tab again. It is weird but can you help me with this?

Alen
  • 203
  • 1
  • 11
  • Did you ever figure this out? There is code somewhere causing the first tab to be selected when the page loads but I can't find it... – JuanR Apr 11 '17 at 03:19

0 Answers0