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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:32:15+00:00 2026-06-04T04:32:15+00:00

i have 2 tables, i want to add rows from one table to another,

  • 0

i have 2 tables, i want to add rows from one table to another, based on the rows selected using checkbox, its adding rows from one table to another table, but its not adding according to rows, but based on cells, here is what i am using:
when the button is clicked, it loops through all the rows which are checked and removes the first cell which is checkbox and adding rest of the cell wrapped in a row to next table, i assume it would wrap the resulting cells into the row, but thats not the case, because when i select multiple rows, it appends directly at the end of last rows last cell.

$("#btnAddStories").click(function () {
            $checkedStories = $("#dnn_TopStories_grdTopStoriesSearch input[type=checkbox]:checked");
            $.each($checkedStories, function (index, item) {
                $row = $(this).closest("tr").clone().find("td:not('.firstCell')").remove();
                $('#tblTopstories tbody').append($row);
            });
        });

enter image description here

  • 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-04T04:32:16+00:00Added an answer on June 4, 2026 at 4:32 am

    Changing answer completely as my previous answer didn’t actually answer your question!

    the problem is that when you set $row, you’re only calling the cells from that row, this happens when you do the .find()

    in order to make it work properly, you’d need to change your append to this:

    $('#tblTopstories tbody').append($('<tr/>', {html: $row});
    

    What that does is it creates a <tr></tr> and sets the html content to the content of the $row

    For clarity of your code, I’d change the name of $row to $cells but that’s just personal preference.

    Also, potential problems arise when you click the #btnAddStories element, so I would change the .click() to .on('click') and add an .off('click') to the start to prevent ghost clicks. (sometimes the event will fire once on your first click, twice on your second etc, calling .off() before an event is assigned prevents the event handler from being applied multiple times, [this usually when the event handler is assigned inside a function])

    $("#btnAddStories").off('click').on('click', function(){
      ...
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add expire TIMESTAMP in DB table. I have one field timestamp
I want make sql query which will insert values from one table to another
I have a situation where I want to associate multiple values from one table
I have two tables (subjects and pages) in one-to-many relations. I want to add
I have a PHP script that inserts rows into a table based on selected
I have 3 tables: Book, Section and Content. I want to add many-to-many relation
I have dbml with single table users i want add partial class for User
I have a table in my markup on which I want to add some
i have a table with about 200,000 records. i want to add a field
I have this JSF table. I want to add row numbers. <?xml version=1.0 encoding=UTF-8?>

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.