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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:06:32+00:00 2026-06-11T17:06:32+00:00

How do I clone and append anchor html value of a list with multiple

  • 0

How do I clone and append anchor html value of a list with multiple <a href="#">Barbara is so nice</a> elements to a div container. I am able to clone the .counter element and append it to the container but wont work with a anchor.

I created a jsFidle here

Here is my js code:

$(window).load(function(){
    $('.ordered-list li a').on("click", function() {
        var button = $(this);
        $('.overlay').fadeIn('slow',function(){
            button.find('.user-comment-list').clone().fadeIn(1000).appendTo('.overlay-content-inner');
            button.find('.counter').clone().appendTo('.overlay-title-content');
    });
});
    $('.icon-remove').click(function(){
        $('.overlay').fadeOut('slow');
        $('.overlay-content-inner, .overlay-title-content').empty();
    });
});
  • 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-11T17:06:33+00:00Added an answer on June 11, 2026 at 5:06 pm

    I’m not sure why you can’t get the anchor value out. You are already in the anchor.

    $('.ordered-list li a').on("click", function() {
    

    You are binding the click event to the anchor. It only adds to the confusion that you name the local variable referencing the current anchor button.

    Instead of:

    button.find('.counter').clone().appendTo('.overlay-title-content');
    

    You can do the following if you want to append the anchor HTML instead:

    $('.overlay-title-content').append(button.html());
    

    DEMO – Appending the anchor HTML value

    In case the link to the DEMO goes stale, here is the new code:

    $('.ordered-list li a').on("click", function() {
        var button = $(this); // not a button! "this" is referencing the clicked anchor.
        $('.overlay').fadeIn('slow', function() {
            button.find('.user-comment-list').clone().fadeIn(1000).appendTo('.overlay-content-inner');
            $('.overlay-title-content').append(button.html());
            //button.find('.counter').clone().appendTo('.overlay-title-content');
        });
    });
    $('.icon-remove').click(function() {
        $('.overlay').fadeOut('slow');
        $('.overlay-content-inner, .overlay-title-content').empty();
    });​
    

    Hope this helps.

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

Sidebar

Related Questions

Right now, I have the following: function jQueryToString( jQueryObject ) { return $('<div>').append(jQueryObject.clone()).remove().html(); }
I am using jquery to clone and append some html into a div. My
I'm attempting to duplicate a div and append it on top of it's clone.
HTML: <div id=panel> <a href=path_to_image1.jpg rel=shadowbox[page]> <img src=scripts/timthumb.php?src=path_to_image1.jpg&w=200&h=20 alt=Image name1 /></a> </div> <div id=thumbs>
I'm trying to append a select option list to a div table with jQuery,
$('.footnote').clone().appendTo('#allfootnotes').append('<br>'); I have a bunch of .footnote elements all through the page, at the
I figured out how to clone my form rows and append an incriminting number
in the following script I clone a new row form tfoot and append it
Im trying to clone tree, remove one element from it and then append result
I'm having this strange problem with cloned elements(using .clone(true)) with draggable and resizable functionalities

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.