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

  • Home
  • SEARCH
  • 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 6069675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:50:52+00:00 2026-05-23T09:50:52+00:00

I am trying to append values from one div to another div. Here is

  • 0

I am trying to append values from one div to another div.

Here is the HTML:

<div>
<input id="appendval" type="text" class="formStyle" style="width:300px">&nbsp;&nbsp;
    <a id="addtolist" onClick="appendthis()" href="javascript:void(0)">Add</a><br><br>
    <div id="addedlist" style="width:300px;height:80px;border:1px #ccc solid;"></div>

    <div id="valdiv" style="display:none">
        <div>
            <img onClick="removethis(this)" src="http://www.penguinmodernclassics.ca/static/images/all/close_icon.gif" >
        </div>
    </div>

</div>

The script:

function appendthis() {
    var values = jQuery('#appendval').val();
    jQuery('#valdiv img').after(values);
    jQuery('#addedlist').append(jQuery('#valdiv').html());
    jQuery('#appendval').val('');
}
function removethis(cur) {
    jQuery(cur).closest('div').remove();
}

The problem is the previous value added up with the new value, every time i click to add.

You can see the above code live here: http://jsfiddle.net/prajan55/3MRK9/

Kindly help…

  • 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-23T09:50:53+00:00Added an answer on May 23, 2026 at 9:50 am

    The problem is, you don’t remove the old text after you add it behind the image. You need an extra container to hold the text so you can easily clear it:

    http://jsfiddle.net/3MRK9/2/

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

Sidebar

Related Questions

Trying to pull info from one JSON datafeed and use that to make another
I'm trying to pass an keydown event from one textbox to another. What I
I have some jQuery code that copies the selected values from one listbox to
Am trying to re-use a function i got from one of the threads on
All I'm trying to do is return the long/lat values from the last know
Trying to honor a feature request from our customers, I'd like that my application,
I'm trying to remove contents of particular div which are basically list items and
I'm trying to send a lot of data from a form using the $.post
I'm trying to extract the subdomain from the HTTP_HOST value. However I've stumbled into
I'm trying to read from two files, and generate output in a third. I

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.