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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:42:28+00:00 2026-06-09T16:42:28+00:00

I am currently working with a wmd editor and jQuery-UI tabs. I have created

  • 0

I am currently working with a wmd editor and jQuery-UI tabs. I have created an ajax/js function that will submit (when next button is clicked) the wmd-preview value and then php echo the result in tab 2. The problem is that I am not getting any results displayed. I am not looking for the textarea value but the div #wmd-preview value. How can I display the value of the div wmd-preview through my ajax/function?

JS

<script>
$(function () {
    var $tabs = $('#tabs').tabs({
        disabled: [0, 1],
        select: function () {
            $.ajax({
                type: "POST",
                url: "post_tabs.php",
                data: {
                    "wmd": $("#wmd-preview").val(),
                },
                success: function (result) {
                    $("#tab-2").html(result);
                }
            });
        }
    });

    $(".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').click(function () {
        var currentTab = $('#tabs').tabs('option', 'selected');
        if (
        (
        currentTab == 0 && /*(B)*/
        $.trim($('#wmd-input').val()).length > 0
        )
        ) {
            var tabIndex = $(this).attr("rel");
            $tabs.tabs('enable', tabIndex).tabs('select', tabIndex).tabs("option", "disabled", [0, 1]);
        } else {
            switch (currentTab) {
            case 0:
                alert('Please fill out all the required fields.', 'Alert Dialog');
                break;
            }
        }
        console.log("preventing default");
        return false;
    });

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

});
</script>

PHP

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

HTML

<div id="tab-1" class="ui-tabs-panel ui-tabs-hide">
    <div id="wmd-button-bar"></div>
    <textarea id="wmd-input" name="wmd-input" cols="92" rows="15" tabindex="6"></textarea>
    <div id="wmd-preview"></div>
</div>

<div id="tab-2" class="ui-tabs-panel ui-tabs-hide">

</div>
  • 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-09T16:42:29+00:00Added an answer on June 9, 2026 at 4:42 pm

    PHP code should start with <?php , yours start with <? which is incorrect.

    When you see PHP code presented as text – it should tell you it is not running, this is why you keep getting output like '.$wmd.''); } ?> instead of real PHP echo output.

    The other comment still stands as well – you should either use $("#wmd-preview").html() or $("#wmd-input").val() but you cannot use val on divs, it does not work.

    In this scenario $("#wmd-input").val() is the better choice just because this is the reason input fields exist – to get input.

    Let me know if there are more questions I can help with.

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

Sidebar

Related Questions

I am currently working with the wmd text editor. I have been able to
Am currently working on an application that requires users to submit posts and comments
Im currently working on an RMI client that will talk to an RMI server
I am currently trying to add the WMD editor to my site. I have
Currently working with converting SQLException error messages into messages that are more useful for
Currently working for the first time with JSON and with little experience of jQuery.
Im currently working on a game that uses multi touch to apply zoom to
I`m currently working out the design for simple graphic editor, who support trivial operations
Am currently working on a site that uses a lot of cfwindow objects and
im currently working on a project that involves listing contacts with a photo and

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.