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 520201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:07:14+00:00 2026-05-13T08:07:14+00:00

How do you bind a function for each index of the jquery UI tabs?

  • 0

How do you bind a function for each index of the jquery UI tabs?

For example, I am creating a 3 part slide sign up, step 1 is a form and has validation, I want to place the code for that inside the load of step1, while also adding classes to the tabs to disable #2 and #3 when on 1, disable #1 and # 3 when on #2

  • 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-13T08:07:14+00:00Added an answer on May 13, 2026 at 8:07 am

    There is no need to bind a function to the tabs, it’s built into the plugin:

    From the plugin page:

    $('#tabs').tabs({
       select: function(event, ui) { ... }
    });
    

    Inside the function, you can determine the current tab you are in and do what you need to do from there:

    • Get the current tab index

      currentTabIndex = $('#tabs').tabs('option', 'selected')
      
    • Get the current tab content ID (from href) – there might be an easier way, but I haven’t found it yet.

      currentTabContent = $( $('.ui-tabs-selected').find('a').attr('href') );
      

    but from seeing the other questions you posted about this tab/form system you are trying to use, I threw together a demo here.

    HTML

    <div id="tabs">
     <ul class="nav"> <!-- this part is used to create the tabs for each div using jquery -->
      <li class="ui-tabs-selected"><a href="#part-1"><span>One</span></a></li>
      <li><a href="#part-2"><span>Two</span></a></li>
      <li><a href="#part-3"><span>Three</span></a></li>
     </ul>
    
     <div id="part-1">
      <form name="myForm" method="post" action="" id="myForm">
       <div class="error"></div>
        Part 1
        <br /><input type="checkbox" /> #1 Check me!
        <br />
        <br /><input id="submitForm" type="button" disabled="disabled" value="next >>" />
      </form>
     </div>
    
     <div id="part-2">
      <div class="error"></div>
       Part 2
       <br />Search <input type="text" />
       <br />
       <br /><input id="donePart2" type="button" value="next >>" />
     </div>
    
     <div id="part-3">
      <div class="error"></div>
       Part 3:
       <br />Some other info here
     </div>
    </div>
    

    Script

    $(document).ready(function(){
     // enable Next button when form validates
     $('#myForm').change(function(){
      if (validate()) {
       $('#submitForm').attr('disabled','')
      } else {
       $('#submitForm').attr('disabled','disabled')
      }
     })
     // enable form next button
     $('#submitForm').click(function(){
        // enable the disabled tab before you can switch to it, switch, then disable the others.
      if (validate()) nxtTab(1,2);
     })
     // enable part2 next button
     $('#donePart2').click(function(){
        var okForNext = true; // do whatever checks, return true 
      if (okForNext)  nxtTab(2,1);
     })
     // Enable tabs
     $('#tabs').tabs({ disabled: [1,2], 'selected' : 0 });
    })
    function validate(){
     if ($('#myForm').find(':checkbox').is(':checked')) return true;
     return false;
    }
    function nxtTab(n,o){
     // n = next tab, o = other disabled tab (this only works for 3 total tabs)
     $('#tabs').data('disabled.tabs',[]).tabs( 'select',n ).data('disabled.tabs',[0,o]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 308k
  • Answers 308k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm pretty sure that in order to do cross domain… May 13, 2026 at 9:50 pm
  • Editorial Team
    Editorial Team added an answer It will be much faster to get an existing system.… May 13, 2026 at 9:50 pm
  • Editorial Team
    Editorial Team added an answer Is something like this possible? No. All you can do… May 13, 2026 at 9:50 pm

Related Questions

I'm lead dev for Bitfighter , and we're working with a mix of Lua
I'm building a concert calendar that's very heavy on javascript (using jQuery). I'm having
I'm having a little problem with form submission with jquery. I've submitted a lot
In order to choose categories, I want to use dropdown lists. Each list contains
I have a table, and when the user clicks on each cell, some details

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.