-3

How can I add new row after clicking Addrow button. Is this possible to add new row with jquery?

<td>
      <input type="button" id="btnnew" value="AddRow" />
      </td>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Abdul Hamid
  • 121
  • 1
  • 1
  • 11

3 Answers3

0

Yo have to call this jquery on the client click event of the button and add new row in table using jQuery:

$("#btnnew").click(function (){
    $('#myTable > tbody:last').append('<tr>...</tr><tr>...</tr>');
}
Bhupendra Shukla
  • 3,814
  • 6
  • 39
  • 62
0

Create a new TR and add it to table based on table id

$(document).ready(function(){
$("#btnnew").bind("click",function(){
var tr=$("<tr>");
$("table tbody").append(tr);
});

});
Sridhar Narasimhan
  • 2,643
  • 2
  • 17
  • 25
0

Create new row and append it to the parent table

$("#btnnew").click(function (){
        $(this).parents("table").append("<tr><td>test</td></tr>");
    });
Sarath
  • 608
  • 4
  • 12