javascript

add table row by javascript onclick

  <input type=“text” name=“” id=“id”> <input type=“text” name=“” id=“name”> <input type=“text” name=“” id=“phone”> <button type=“button” onclick=“add_row()“> ADD ROW </button> <table id=“ThisTable” border=“1”> <tr> <th>Id</th> <th>name</th> <th>phone</th> </tr> <tr> <td>Data1</td> <td>Data1</td> <td>Data1</td> </tr> <tr> <td>Data2</td> <td>Data2</td> <td>Data2</td> </tr> </table> <script> function add_row() { var id = document.getElementById(“id”).value; var name= document.getElementById(“name”).value; var phone = document.getElementById(“phone”).value; // console.log(id …

add table row by javascript onclick Read More »