How to I link to specific tab?
-
I’m using getwid tabs. I’d like to link to a specific tab.
I’m not very good with javascript. I’ve tried writing a code but it doesn’t work. Could someone help?
const activate_tab = urlParams.get(‘tab’);
var indexValue = 1;
$(“[class=’wp-block-getwid-tabs__nav-link’]”).each(function( index, element ) {
var $input = $(this);
// element == this
if (indexValue == activate_tab) {
$input.attr(“tabindex”, 0);
$input.attr(“aria-selected”, true);
$input.attr(“aria-expanded”, true);
$input.addClass(“ui-tabs-active”);
$input.addClass(“ui-state-active”);
}else{
$input.attr(“tabindex”, -1);
$input.attr(“aria-selected”, false);
$input.attr(“aria-expanded”, false);
$input.removeClass(“ui-tabs-active”);
$input.removeClass(“ui-state-active”);
}
indexValue += 1;
});`
- The topic ‘How to I link to specific tab?’ is closed to new replies.