Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging Javascript tabs with a button?
    primarykey
    data
    text
    <p>I'm working on a website that's implementing tabs via javascript, and I'd like to create a button that goes to the 'next' tab. I don't care if I have to hardcode in the tab IDs into the javascript or what, but regardless I'd like to be able to advance the tabs.</p> <p>EDIT3: Here's a jfiddle implementation of what I have. I just want the next button to be able to advance the tabs similar to clicking on them. Thanks!</p> <p><a href="http://jsfiddle.net/Cd5qb/" rel="nofollow">http://jsfiddle.net/Cd5qb/</a> </p> <p>Here's the code I have for the current working tabs, without a button:</p> <pre><code>var tabContents = $(".tab_content").hide(), tabs = $("ul.tabs li"); tabs.first().addClass("active").show(); tabContents.first().show(); tabs.click(function() { var $this = $(this), activeTab = $this.find('a').attr('href'); if(!$this.hasClass('active')){ $this.addClass('active').siblings().removeClass('active'); tabContents.hide().filter(activeTab).fadeIn(); } return false; }); </code></pre> <p>So I'm trying to implement something similar to the tabs.click for a button, and here's what I've got so far:</p> <pre><code>var tabbtn = $(".tabbutton"); tabbtn.click(function() { var listItem = document.getElementById('tab2'); var $this = $(this), activeTab = $this.find('a').attr('href'); tabContents.hide().filter("#tab2").fadeIn(); return false; }); </code></pre> <p>This will actually display the right tab's information, but it won't change which tab header is highlighted.</p> <p>Anyone have any ideas? Thanks in advance for the help! </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload