"Dynamic Table row creation and Deletion"
Bootstrap 3.0.3 Snippet by anupr

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row clearfix"> <div class="col-md-12 column"> <table class="table table-bordered table-hover" id="tab_logic"> <thead> <tr > <th class="text-center"> # </th> <th class="text-center"> Formula </th> </tr> </thead> <tbody> <tr id='formula0'> <td> 1 </td> <td> <input type="text" name='formula0' placeholder='Formula' class="form-control formula last"/> </td> </tr> <tr id='formula1'></tr> </tbody> </table> </div> </div> </div>
var i=1; $(document).on('focusout', '.last', function(){ if(this.value != ''){ $('.last').removeClass('last'); $('#formula'+i).html("<td>"+ (i+1) +"</td><td><input name='formula"+i+"' type='text' placeholder='Formula' class='form-control input-md formula last' /> </td>"); $('#tab_logic').append('<tr id="formula'+(i+1)+'"></tr>'); i++; } });

Related: See More


Questions / Comments: