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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:35:02+00:00 2026-05-14T08:35:02+00:00

In the HTML below, I would like to copy the submittedby beside message, within

  • 0

In the HTML below, I would like to copy the “submittedby” beside “message”, within the H2 tag:

<div class="comment">
<H2 class="threadtitle">Message 1</h2>
<span class="submittedby">James</a>
</div>

<div class="comment">
<H2 class="threadtitle">Message 2</h2>
<span class="submittedby">Bill</a>
</div>

<div class="comment">
<H2 class="threadtitle">Message 3</h2>
<div class="submittedby">Phil</a>
</div>

My current jQuery code is as follows:

$(document).ready(function() { 
    $('.submittedby').copy().appendTo('.threadtitle');
});

The problem is this copies EVERY “submittedby” to EVERY “threadtitle”. How do I code it so it only copies the “submittedby” from within the same “comment” div?
Thanks!

  • 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-14T08:35:02+00:00Added an answer on May 14, 2026 at 8:35 am

    Use .each() here, like this:

    $(function(){ 
      $('.submittedby').each(function() {
        $(this).clone().appendTo($(this).siblings('.threadtitle'));
      });
    });
    

    This loops over each .submittedby element, and moved it around with respect to the current .submittedby you’re on in the loop, so each one’s handled individually. Also I assumed you meant .clone() here, but if you’re actually using the .copy() plugin, just replace .clone() with .copy() in the code above.

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

Sidebar

Related Questions

If I have the HTML below: <div style=display:none;> <span id=hello>Hey</span> </div> And I do
Please check my HTML below: <table cellpadding=0 cellpadding=0 border=0> <tr> <td> <div class=toogler>Demo1</div> </td>
Conside below html - <div class=container1> <div class=container2> <div class=container3> <div class=container4> <div class=element>
In the HTML table below, I would like to add a third column that
I have html eg below and would like to use regular expressions to change
I have the below HTML string, and I would like to turn it into
In the HTML below, the layout works when the actionBar class has a float
I have an attribute in my model which contains html string like below: <p>Solution
I have loaded HTML into pyqt and would like to create a list of
I have the array below which I would like to output in a specific

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.