Js simple table add row and delete row operation example
<html><head><script src="http://code.jquery.com/jquery-1.11.0.min.js"></script><script>//Create an HTML elementfunction $c(tagname){return document.createElement(tagname);}//The content to be executed after the document is loaded$(document).ready(function(){//Binds the click event of the add row button$("#addrow").bind("click",function(){//In the tablevar tab = $("#tab");//Create the tr elementvar tr = $c("tr");//Append the tr element to the tabletab.append(tr);//Create td elementsvar td1=$c("td");//The contents of the td elementtd1.innerHTML="insert1";//Appends the td element for the newly appended trtr.appendChild(td1);var td2=$c("td");td2.innerHTML="insert2";tr.appendChild(td2);});//Bind the click event of the delete row button$("#deleterow").bind("click",function(){//Get the first row of the tablevar tab = $("#tab tr:eq(0)");//Delete this triptab.remove();});});</script></head><body><table border='1' id="tab"><tr><td>123</td><td>456</td></tr></table></br><button id="addrow"> Add the line </button><button id="deleterow"> Delete rows </button></body></html>