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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:38:25+00:00 2026-05-26T17:38:25+00:00

I have seen similar examples but have not seen exactly what I am looking

  • 0

I have seen similar examples but have not seen exactly what I am looking for.
I have created a scheduling system based on the time of day.
This means I have 24 rows.
The first td of each row has a button with the class “go”.
I am trying to create a snippet that… when an individual button is clicked on a specific row that row is cloned and inserted on the next line of the table.
I have accomplished this with a single button and have used the insertAfter object.
I assume I have to do something with the .each but am not very familiar with it.
This is an example of an attempt.
Note that in this case I used an id of go and I created a hidden tr with the id to_be_cloned and inserted it after row 1.
I need to be able to insert the row after any other row upon clicking that rows button. (if that makes any sense)

$("#go").click(function() { 
    $("#to_be_cloned").clone().show().attr('id','').insertAfter("#1");
})
  • 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-26T17:38:25+00:00Added an answer on May 26, 2026 at 5:38 pm

    Use a class to bind the event to the button instead of an id.
    It is not valid if you have duplicate ID’s also, an ID can not start with a numeric value.

    <table>
       <tr>
          <td><input type="button" class="insertButton" value="Go"/></td>
          <td>Hello World</td>
       </tr>
    </table>
    
    
    $(document).ready(function(){
       $('.insertButton').live('click', function(){
           var row = $(this).closest('tr').clone();
           $(this).closest('table').append(row);
       });
    });
    

    jsFiddle Example

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

Sidebar

Related Questions

I have seen several similar questions, but not found the exact answer I'm looking
I have seen several posts similar to this but none with a strait forward
I have seen several other posts with similar questions but nothing exactly like what
I have seen this similar question on SO in a few places but all
I have seen other thread with similar issue but was not able to work
I have seen similar questions here but I just can't understand them. I am
I have seen similar questions ( 1 , 2 ), but none of them
i have seen similar posts here but i have had no luck solving my
I have seen a similar related post but my situation is a little different
I've seen a few similar posts and have tried out the answers given, but

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.