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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:23:29+00:00 2026-05-25T11:23:29+00:00

i have a simple jquery tab and a form. When i post the form

  • 0

i have a simple jquery tab and a form. When i post the form the page refreshes and it goes to the default tab. you can see the code in jsfiddle also here:

<ul class="tabs">
<li><a href="#tab1">Home</a> | </li>
<li> | <a href="#tab2">Top 10</a> | </li>
</ul>

<div id="tab1" class="tab_content">234</div>
<div id="tab2" class="tab_content">
<form method="post"> 
<select name="item"> 
<option>Paint</option><option>Brushes</option>
</select>
Quantity: <input name="quantity" type="text" /> 
<input type="submit" />
</form>
</div>

 //When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content

//On Click Event
$("ul.tabs li").click(function() {
    $('ul.tabs li#none').removeClass('visible');
    $('ul.tabs li#none').addClass('none');
    $("ul.tabs li").removeClass("active"); //Remove any "active" class
    $(this).addClass("active"); //Add "active" class to selected tab
    $(".tab_content").hide(); //Hide all tab content

    var activeTab = $(this).find("a").attr("href"); 
    $(activeTab).fadeIn(); //Fade in the active ID content
    return false;
});

so again, what i want to accomplish is when i submit a form to redirect back to the tab of my choice.

any ideas?

thanks

  • 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-25T11:23:30+00:00Added an answer on May 25, 2026 at 11:23 am

    A simple idea: add a hidden input field to the form (for reference) and then, in the part of the javascript code, after the tab code, something like:

    <?php if(isset($_POST['thehiddenfield'])) { ?>
    $('a#tabtoshow').trigger('click'); //here, select by ID the tab you need to show
    <?php } ?>
    

    That should do the trick, sorry i dont have time to write the full exact code. I hope it helps.

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

Sidebar

Related Questions

I have a simple jQuery code that runs on a web page that has
I have a simple form right now: <form action='<? echo $PHP_SELF;?>' method='POST'> Username:<input type='text'
I have a simple jquery tab, which works fine in all browser except ie
I have a simple Tab Navigation with jquery. Whenever a new tab is clicked,
I have a question about ultra simple jquery tabs. I use this script: http://jsfiddle.net/HX5KZ/2/
I have a page with tabs on it that you this jQuery script http://www.sohtanaka.com/web-design/simple-tabs-w-css-jquery/
I have a simple menu on a web page, based on the jQuery Accordion.
I have a simple jquery animation on a div, which is inside a div,
I have a simple jquery/ajax request to the server which returns the structure and
I have a very simple jQuery script.. all I want it to do is

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.