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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:36:38+00:00 2026-06-12T01:36:38+00:00

Adding a single row in a table (html) and deleting it, using JavaScript, is

  • 0

Adding a single row in a table (html) and deleting it, using JavaScript, is simple. But, is it possible to add multiple rows, like 2 or more, by calling the addrow function only once? The added rows will have different elements, like first row will be having a textfield, the other a textarea and like that…

Is there any other alternative in html to do that?

  • 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-12T01:36:39+00:00Added an answer on June 12, 2026 at 1:36 am

    I solved it by myself by writing code similar to this :

    adding three rows,first with a textfield,second having a textarea and the third having a button

    function addRow(tableId)
     {
      var addrow=1;
      var table=document.getElementById(tableId);
      var rowCount=table.rows.length;
      for(var i=1;i<=3;i++)
       {
        if(addrow==1)
        {
          var newRow=table.insertRow(rowCount);
          var cell0=newRow1.insertCell(0);
          var element0=document.createElement("input");
          element0.type="text";
          cell0.appendChild(element0);
        }
        if(addrow==2)
        {
          var newRow2=table.insertRow(rowCount);
          var cell0=newRow1.insertCell(0);
          var element0=document.createElement("textarea");
          cell0.appendChild(element0);
        }
        if(addrow==3)
        {
          var newRow3=table.insertRow(rowCount);
          var cell0=newRow1.insertCell(0);
          var element0=document.createElement("input");
          element0.type="button";
          cell0.appendChild(element0);
        }
    addrow++;
       }
     }
    

    Each time the for loop runs, a new html element is added in the table and hence I got three rows added dynamically each having a different element .

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

Sidebar

Related Questions

DataTable.Rows.Add() adds a row to the data table. However, how does it handle the
Adding the row one by one in the button click.. (i tried but its
Adding strings localization files in iPhone bundle is very simple and perfectly fine but
I want to add 1 year to a datetime-type column in every single row
I have a form that searches all rows in a single table (TServices) that
What i wanna do is adding a single colorbar (at the right side of
I am adding a series of records (eg 100) per single transaction. I want
Adding Exceptional Handling is a good practise, but I have a doubt, In our
I have a huge form that has around 110 fields columns (single row) that
I am having real troubles adding a UIImageView to a single UITableView cell. In

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.