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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:09:59+00:00 2026-06-11T10:09:59+00:00

There is a table with a link that adds a new row when clicked:

  • 0

There is a table with a link that adds a new row when clicked:

    <table>
                <thead>
                  <tr>
                    <th scope="col">col1</th>
                    <th scope="col">col2</th>
                    <th scope="col">col3</th>
                  </tr>
                </thead>

                <tbody>
                  <tr>
                    <td><input name="col1" id="col1"></td>
                    <td><input name="col2" id="col2"></td>
                    <td>
                      <select name="col3" id="col3">
                        <option value="">Please select</option>
                        <option value="1">select1</option>
                        <option value="2">select1</option>
                        <option value="3">select1</option>
                      </select>
                    </td>
                  </tr>
                </tbody>
            </table>
<a href="#" id="addLink">+</a>

when the link is clicked, I want to add a new row but without the 3rd column to the end of the table. so I used JQuery to do it:

$(document).ready(function(){
                $('#addLink').click(function(){
                    addTableRow($("table"));
                    return false;
                }); // end click
            function addTableRow(table)
            {
                // get the first row in the table
                var $tr = $(table).find("tbody tr:first").html();

                $($tr).remove('td:last'); // remove the last column 


                $('tbody').append("<tr>");
                $(table).find('tbody tr:last').append($tr);


                        };
            }); // end ready

however, this part is not removing the 3rd column:

$($tr).remove('td:last'); // remove the last column

is there any way to append a new row with just the first 2 column?

Thanks in advance 🙂

  • 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-11T10:10:00+00:00Added an answer on June 11, 2026 at 10:10 am

    is this what you’re looking for?

    i changed a few other things as well, you’ll get the idea.

    $(document).ready(function(){
      $('#addLink').click(function(){
        addTableRow($("table"));
        return false;
      }); // end click
      function addTableRow(table) {
        // get the first row in the table
        var $tr = table.find("tbody tr:first").html();
    
    
        $('tbody').append($('<tr/>'));
        table.find('tbody tr:last').append($tr).find('td:last').remove();
    
    
      };
    }); // end ready​
    

    http://jsfiddle.net/QTuzM/

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

Sidebar

Related Questions

I have a table of Items, and in each row there is a link
Consider that there is a bunch of tables which link to countries or currencies
In a MySQL (5.1) database table there is data that represents: how long a
I have a dynamically generated table and for each row in the table there
I have Question and QuestionTypes. In Question table there is a foreign key that
I have a didSelectRowAtIndexPath action that adds a navigation bar and displays a new
We have a link table that can handle multiple types of object on one
On my site, it displays a table of data. I've got a link that
I have a table which needs to link one of three seperate tables, but
Is there a table i can query all of Oracle Reserved Words? Example, i

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.