-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,438
  • 68
  • 55
  • 126
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,766
  • 6
  • 36
  • 61
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,613
  • 2
  • 15
  • 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
  • 588
  • 3
  • 12