Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4561886
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:08:17+00:00 2026-05-21T18:08:17+00:00

I added the buttons and set the hrefs for previous and next links to

  • 0

I added the buttons and set the hrefs for previous and next links to the hrefs from the list items. The links look right in the browser when I click on previous or next, but they go to the same page instead of the specified tab.

I have a dozen of these forms with the tabs and each form has a different number of tabs. The tabs are static (not pulled in with AJAX), and I’d really like to set their hrefs dynamically instead of laying out each one the way I did below. (Each tab has an id that begins with subform.

I looked at this conversation on select with the tabs plugin but wasn’t sure how to apply it to my situation. I’m really new at jQuery! The more I know, the more I want to do and it seems like the less I know! I’d appreciate any advice!!

HTML:

<ul class="tabNavigation">
    <li class="tabs-selected">
        <a href="#tab_1">Organization</a></li>
    <li><a href="#tab_2">Leaders</a> </li>
    <li><input type="submit" name="submit" value=" Save " /></li>
</ul>

<!-- tab containers -->
<div class="tabs-container" id="tab_1">
    <div class="subform" id="subform1">
        <? include_once ('org.php'); ?>                   
    </div>
</div>

<div class="tabs-container" id="tab_2">
    <div class="subform" id="subform2">
        <? include_once ('event.php'); ?>                   
    </div>
</div>

jQuery:

$(document).ready(function() { 
    //add previous/next buttons to bottom of each subform
    $(".subform").append('<div id="nav_buttons"><p><a href="" class="previous floatleft">Previous</a> <a href="" class="next floatright">Next</a></p></div>');

    $("#subform1 .previous").hide(); //hide previous button on tab_1 
    $("#subform1 a.next").attr("href","#tab_2");
    $("#subform2 a.previous").attr("href","#tab_1");
    $("#subform2 .next").hide(); //hide next button on last tab

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T18:08:17+00:00Added an answer on May 21, 2026 at 6:08 pm

    I found the answer on Cris Coyier’s site, CSS-Tricks. The article, jQuery UI Tabs with Next/Previous

    Here is the code that worked:

    $(function() {
        var $tabs = $('.form-tabs').tabs();
        $(".tabs-container").each(function(i){
            var totalSize = $(".tabs-container").size() - 1;
            if (i != totalSize) {
                next = i + 2;
                $(this).append("<a href='#' class='next-tab mover' rel='" + next + "'>Continue &#187;</a>");
            }
            if (i != 0) {
                prev = i;
                $(this).append("<a href='#' class='prev-tab mover' rel='" + prev + "'>&#171; Back</a>");
            }
        });
        $('.next-tab, .prev-tab').click(function() { 
            $tabs.tabs('select', $(this).attr("rel"));
            return false;
        });
    });
    

    What’s cool about it is that it finds the number of divs (that provide content for each tab) and then appends the next/previous buttons programmatically, skipping the first previous button and the last next button.

    Works great!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with some dynamically added buttons. If you click a button
If buttons are dynamically added in wpf from code behind how can you add
I've just created UITableViewCell. I added to it two buttons. Then I set transparent
I've added some buttons to an UIView (via addSubview) programmatically. However, they appear as
I created a simple dialog-based application, and in the default CDialog added three buttons
I've added social media buttons on my sidebar using PHP and HTML syntax. However
I've added 2 image buttons in my master page. Their purpose is to change
I found one example in which buttons are added to panels (instances of JPanel
I have a form in which several buttons are added at runtime via a
I have an html 5 video which i remove the control buttons and added

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.