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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:59:28+00:00 2026-06-15T04:59:28+00:00

I have this http://jsfiddle.net/NgEpS/1/ basically, I am getting the value of a textarea on

  • 0

I have this http://jsfiddle.net/NgEpS/1/ basically, I am getting the value of a textarea on each form and the appending the value to a child div, everything works.perfect after the first submit, but if you submit more than once the same form, my script is cloning all the previous replies, wondering if there is any way to avoid this.

HTML:

        <div class="post-container">
            <form class="reply-form">
                <div class="reply-box">
                    <textarea placeholder="Reply box 1..." columns="10" rows="1" name="comment-input"></textarea>
                    <input type="submit" value="Send">
                </div>
                <div class="post-dropdown"></div>
                <div class="post-dropdown-content">
                    <div class="post-dropdown-reply">1</div>
                </div>
            </form>
        </div>

        <div class="post-container">
            <form class="reply-form">
                <div class="reply-box">
                    <textarea placeholder="Reply box 2..." columns="10" rows="1" name="comment-input"></textarea>
                    <input type="submit" value="Send">
                </div>
                <div class="post-dropdown"></div>
                <div class="post-dropdown-content">
                    <div class="post-dropdown-reply hidden"></div>
                </div>
            </form>
        </div>

        <div class="post-container">
            <form class="reply-form">
                <div class="reply-box">
                    <textarea placeholder="Reply box 3..." columns="10" rows="1" name="comment-input"></textarea>
                    <input type="submit" value="Send">
                </div>
                <div class="post-dropdown"></div>
                <div class="post-dropdown-content">
                    <div class="post-dropdown-reply">1</div>
                    <div class="post-dropdown-reply">2</div>
                    <div class="post-dropdown-reply">3</div>
                    <div class="post-dropdown-reply">4</div>
                </div>
            </form>
        </div>
        p​

JavaScript:

        function gettingReplyVal() {

            $('.reply-form').submit(function(e) {
                var post_clone =    $('.post-dropdown-content').first().clone();

                var textAreaValue = $(this).find('textarea').val();

                 $(post_clone).insertBefore($(this).f ind(".post-dropdown-content")).find('.post-dropdown-reply').html(textAreaValue); 

                e.preventDefault();

            });
        }

        gettingReplyVal();
  • 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-15T04:59:29+00:00Added an answer on June 15, 2026 at 4:59 am

    On this line

    $(post_clone).insertBefore($(this).find(".post-dropdown-content")).find('.post-dropdown-reply').html(textAreaValue); 
    

    $(this).find(".post-dropdown-content") returns all the post-dropdown-content elements inside this. The first time you hit send, there is only one, so it behaves normally, but the second time it finds two, the third time it finds three, etc…

    use $(this).find(".post-dropdown-content").first() instead

    $(post_clone).insertBefore($(this).find(".post-dropdown-content").first()).find('.post-dropdown-reply').html(textAreaValue); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form http://jsfiddle.net/thiswolf/XDsSt/ with four identical inputs and buttons.The problem is,each section
I have this script http://jsfiddle.net/gphp/ZMmRv/4/ I have two events: 1 - the div is
I have this code: http://jsfiddle.net/cmF4S/3/ <div style=float: left; position: relative;> <input type=text placeholder=Search... style=float:
I have this html with css: http://jsfiddle.net/krhxG/ I set the width of the div
I have this code : http://jsfiddle.net/Qchmqs/BSKrG/ <div class=step><-- this is darned wrong <div id=step2><a>Darn</a></div>
I have this example: http://jsfiddle.net/WkpL9/ HTML: <div class=span2> <div class=image-container> <img alt= src=http://placehold.it/150x120/> <p>asdadsadasdasdsadasdasdasdasdsadsad</p>
I currently have this code: http://jsfiddle.net/D5EMp/25/ This code fades in/out a div with a
I have this example http://jsfiddle.net/HnfCU/ I use jQuery to show and hide the .child
I have this form: http://jsfiddle.net/michelejs/Pt6LQ/ The problem is that I am not be able
I have this code: http://jsfiddle.net/gk5pV/8/ It's function is to add a td value to

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.