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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:36:53+00:00 2026-06-09T22:36:53+00:00

I am currenlty working with jquery ui tabs(which works only with next/previous buttons) and

  • 0

I am currenlty working with jquery ui tabs(which works only with next/previous buttons) and a textarea. I have developed an ajax/js function that will auto submit the value stored in the text area and php echo the result in tab#2. But I am currently want to change the method from auto submitting the form to submit when the user clicks the Next button to adavance to the next. How can I submit the value inside a text field when clicking the next button in a jquery ui tabs? Here is my EXAMPLE with autosubmit

PREVIOUS/NEXT

<script>
$(function() {
    var $tabs = $('#tabs').tabs({
    disabled: [0, 1] });
    $(".ui-tabs-panel").each(function(i) {
             var totalSize = $(".ui-tabs-panel").size() - 1;
                         if (i != totalSize) {
        next = i + 2;
            $(this).append("<a href='#' class='next-tab mover' rel='" + next + "'>Next Page &#187;</a>");
                    }

     if (i != 0) {
    prev = i;
    $(this).append("<a href='#' class='prev-tab mover' rel='" + prev + "'>&#171; Prev Page</a>");
    }
});

 $('.next-tab, .prev-tab').click(function() {
    var tabIndex = $(this).attr("rel");
    $tabs.tabs('enable', tabIndex)
    .tabs('select', tabIndex)
    .tabs("option","disabled", [0, 1]);
    return false;
});

});

HTML/PHP

<?
  if (isset($_POST['wmdVal'])){
    $wmdVal = $_POST['wmdVal']; 
        echo ('<div id="wmd_result"><span id="resultval"><h2>PHP Echo result:</h2>'.$wmdVal.'</span></div>');
}
?>

<textarea id="wmd-input" name="wmd-input"></textarea>
<input type="hidden" id="myhidden" name="myhidden" value="<? $wmdVal ?>">
  • 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-06-09T22:36:55+00:00Added an answer on June 9, 2026 at 10:36 pm

    Remember on which tab you are (currentTab). If a tab is selected, check if the first tab is leaving; if yes send the ajax request with the current preview html; no success handler is needed, we don’t need any client changes. If the next tab is shown, reset the currentTab index. On server side (php) you can e.g. save the data to the database but doesn’t need any result.

    <!DOCTYPE HTML>
    <html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Hello</title>
        <link type="text/css" href="css/postingtabs.css" rel="stylesheet">
        <link type="text/css" href="css/wmd.css" rel="stylesheet">
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js"></script>
        <script type="text/javascript" src="js/wmd.js"></script>
        <script type="text/javascript" src="js/showdown.js"></script>
    
        <script type="text/javascript">
            var currentTab = 0;
    
            $(function() {
                var $tabs = $('#tabs').tabs({
                    disabled: [0, 1]
                    , select: function() {
                        if (currentTab == 0) {
                            $.ajax({
                                type: "POST",
                                url: "test1.php",
                                data: { "wmdVal": $("#wmd-preview").html() }
                            });
                        }
                    }
                    , show: function(event, ui) {
                        currentTab = ui.index;
                    }
                });
    
                $(".ui-tabs-panel").each(function(i) {
                    var totalSize = $(".ui-tabs-panel").size() - 1;
                    if (i != totalSize) {
                        next = i + 2;
                        $(this).append("<a href='#' class='next-tab mover' rel='" + next + "'>Next Page &#187;</a>");
                    }
                    if (i != 0) {
                        prev = i;
                        $(this).append("<a href='#' class='prev-tab mover' rel='" + prev + "'>&#171; Prev Page</a>");
                    }
                });
    
                $('.next-tab, .prev-tab').click(function() {
                    var tabIndex = $(this).attr("rel");
                    $tabs.tabs('enable', tabIndex)
                        .tabs('select', tabIndex)
                        .tabs("option","disabled", [0, 1]);
                    return false;
                });
            });
        </script>
    </head>
    <body>
        <div id="page-wrap">
            <div id="tabs">
                <ul>
                    <li><a href="#tab-1">1</a></li>
                    <li><a href="#tab-2">2</a></li>
                </ul>
    
                <div id="tab-1" class="ui-tabs-panel ui-tabs-hide">
                    <div id="wmd-editor" class="wmd-panel">
                        <div id="wmd-button-bar"></div>
                        <textarea id="wmd-input" name="wmd-input"></textarea>
                    </div>
                    <div id="wmd-preview" class="wmd-panel"></div>
                </div>
    
                <div id="tab-2" class="ui-tabs-panel ui-tabs-hide"></div>
            </div>
        </div>
    </body>
    </html>
    

    === UPDATE ===

    If you really want to see a result temporarily for testing, add the success handler again to the ajax parameters:

    success: function(result) {
        $('#wmd_result').html( $('#resultval', result).html()); 
    }
    

    And append the result div again to the end of first tab:

    <div id="wmd_result"></div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with a tabbed interface and have the following jQuery function set up
I am currently working with a wmd editor and jQuery-UI tabs. I have created
I'm currently working on a jQuery carousel which works fine in all browsers except
I am using jQuery Tools Slideshow & Tabs for a project I am working
I am working with dynamic tabs in jQuery . When the user opens a
Stackoverflow, I am working with the Tabs via the Jquery Tools: Tabs system and
I am currently working on rails3 application that uses jQuery. I have a javascript
http://jsfiddle.net/danesoul/tSCus/2/ - Here is working example of simple JQuery UI Tabs interface. Commented string
I'm currently working on a webproject. I have to use a carousel Jquery, found
I'm currently working on a userscript with jquery, which calls https requests on a

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.