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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:58:12+00:00 2026-06-14T17:58:12+00:00

Hi all iam working on jquery here i have a html page. in the

  • 0

Hi all iam working on jquery here i have a html page. in the html i have two div’s in those firstdiv contains
image, name, and price right now we have to move(add) image to another div which is empty div here i had done to (move) add
image form first to secound but problem is when image added to the secound div the images should be appear in the
same place in first div and also in the secound div i had done to image add to secound div but images removes from the first div
this is my code follows:

               <div>              
                <span class="span1">
                <img src="~/Images/galaxy.jpeg" /></span> 
            <span class="span1">1232</span>
            <span class="span2">Cell Phone</span> 
            <span class="span1">3500</span>              
           <a href="#" class="pull-right" ><i class="icon-plus" onclick="AddToCart(this)" id="btnid" ></i></a>
        </div>


           <div class="span7" style="border:1px black" id="separat">
            </div>

in the above code iam having ‘icon-plus’ button when i click the button it adding image to the secound div but i need
images should add and it shoul appear in the same place also

and this is my jquery

              $(function () {             
       AddToCart(this);                
  });
    function AddToCart(obj) {
        var val = 0;
      var $this = $(obj).closest('div');
      var img = $this.find('img');
      var image=img;
      $('#separat').append(img);
      }

Could anybody please help me to do this?

  • 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-14T17:58:14+00:00Added an answer on June 14, 2026 at 5:58 pm

    you sholud use clone()

    function AddToCart(obj) {
            var val = 0;
          var $this = $(obj).closest('div');
          var img = $this.find('img').clone();
          var image=img;
          $('#separat').append(img);
          }
    

    http://api.jquery.com/clone/

    The .clone() method performs a deep copy of the set of matched
    elements, meaning that it copies the matched elements as well as all
    of their descendant elements and text nodes. When used in conjunction
    with one of the insertion methods, .clone() is a convenient way to
    duplicate elements on a page.

    UPDATE

    if you want to get the prize and name

    prize = $(obj).closest('.span2').clone();
    name = $(obj).closest('.span1').clone();
    
    $('#separat').append(img+prize+name);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi all i am working on jquery i have a text area i need
I have a working webpage which just displays external html files inside a div
My image upload form on my profile edit page isn't working. The two forms
I am working with js and jquery. I have a test login page I'm
Hello all I am working on javascript jquery and svg.I want to ask a
Hello all I am working on html and javascript.And I am going to ask
hello all i am working on a project in which i have a webpage
I am working on several reports all of which have similar layouts I would
I am working for international clients who have all very different alphabets and so
I am trying to get jquery.raty working with Django. I have the serving of

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.