-8

I need to create one HTML table using JSON data. need to add one button on each row .. (add row).

add_row button functionality

need to copy the content of the above row and create a new row below that row.

also, the button can add multiple rows at a time

I think this is a little challenging task; please help me.

2

1 Answer 1

0

Not really sure what you are after sorry, but the following might help you out.

$(document).ready(function () {
   $('#my_button').click( function (e) {
      var dynamic_html = "<tr>whatever data you want (including raw html) </tr>";
        jQuery('#my_table').append(dynamic_html);
   });
}

Inside the "dynamic_html" you can put any text/html that you want. You can add in your table cells and the button that you are talking about. When being appended it html tags will be read as html and add to your page.

Sign up to request clarification or add additional context in comments.

2 Comments

how should me handle copy tha data of current row to newly creted row
Can I see the table html please

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.