How to Add and Remove Table Rows Dynamically

How to Add and Remove Table Rows Dynamically - How to Add and Remove Table Rows Dynamically
Add and remove table rows dynamically is incredibly simple victimization jquery clone and take away perform.
Almost all the time we want this feature on our online page whereas we have a tendency to make any huge or little application, therefore.
Let Maine show you the way you’ll add rows dynamically with terribly minimal code and responsive table style victimization bootstrap and jquery.
Just see the below operating demo.!!


Copy and Paste below HTML script to add this feature to your web page.

<link  rel="stylesheet" type="text/css" href="">
<table  class="table table-hover small-text" id="tb">
<tr class="tr-header">
<th>Full Name</th>
<th>Mobile No.</th>
<th>Email Id</th>
<th><a href="javascript:void(0);" style="font-size:18px;" id="addMore" title="Add More Person"><span class="glyphicon glyphicon-plus"></span></a></th>
<td><input type="text" name="fullname[]" class="form-control"></td>
<td><select name="designation[]" class="form-control">
  <option value="" selected>Select Designation</option>
    <option value="Engineer">Engineer</option>
    <option value="Accountant">Accountant</option>
<td><input type="text" name="mobileno[]" class="form-control"></td>
<td><input type="text" name="emailid[]" class="form-control"></td>
<td><a href='javascript:void(0);'  class='remove'><span class='glyphicon glyphicon-remove'></span></a></td>
<script src=""></script>
<script src=""></script> 
    $('#addMore').on('click', function() {
              var data = $("#tb tr:eq(1)").clone(true).appendTo("#tb");
     $(document).on('click', '.remove', function() {
         var trIndex = $(this).closest("tr").index();
            if(trIndex>1) {
           } else {
             alert("Sorry!! Can't remove first row!");

Demo | Download

Add a Comment