"Course List Create"
Bootstrap 3.0.0 Snippet by HakerTag

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <form class="container"> <div class="row setup-content" id="step"> <div class="col-xs-12"> <div class="col-md-12 well text-center"> <h1> Course List</h1> <!-- <form> --> <div class="container col-xs-12"> <div class="row clearfix"> <div class="col-md-12 column"> <table class="table table-bordered table-hover" id="tab_logic"> <thead> <tr style="width:100%"> <th class="text-center" style="width:10%"> # </th> <th class="text-center" style="width:30%"> Course Code </th> <th class="text-center" style="width:70%"> Course Name </th> </tr> </thead> <tbody> <tr id='course0'> <td> 1 </td> <td> <input type="text" name='courseCode0' placeholder='Course Code' class="form-control"/> </td> <td> <input type="text" name='courseName0' placeholder='Course Name' class="form-control"/> </td> </tr> <tr id='course1'></tr> </tbody> </table> </div> </div> <a id="add_row" class="btn btn-success pull-left">Add Row</a><a id='delete_row' class="btn btn-danger pull-right">Delete Row</a> </div> <!-- </form> --> <button id="submite" class="btn btn-primary btn-md">Submite</button> </div> </div> </div> </form>
body{ margin-top:20px; }
$(document).ready(function(){ var i=1; $("#add_row").click(function(){ $('#course'+i).html("<td>"+ (i+1) +"</td><td><input name='courseCode"+i+"' type='text' placeholder='Course Code' class='form-control input-md' /> </td><td><input name='CourseName"+i+"' type='text' placeholder='Course Name' class='form-control input-md'></td>"); $('#tab_logic').append('<tr id="course'+(i+1)+'"></tr>'); i++; }); $("#delete_row").click(function(){ if(i>1){ $("#course"+(i-1)).html(''); i--; } }); });

Related: See More


Questions / Comments: