[ingrese la descripción de la imagen aquí] [1] [1]: https://i.stack.imgur.com/ONkAu.jpg
function addinfo() { var c_name = document.getElementById("c_name").value; var c_mobile = document.getElementById("c_mobile").value; var rows_count = document.getElementById("addinfo").rows.length; $('#addinfo').append('<tr><td><input type="text" name="in_sr[]" id="in_sr" value="'+ rows_count +'" readonly/></td><td><input type="text" name="in_cname[]" id="in_cname" value="'+ c_name +'" readonly/></td><td><input type="text" name="in_cmobile[]" id="in_cmobile" value="'+ c_mobile +'" readonly/></td>'); } table,thead,tr,th,tbody,tr,td{border: 1px solid;} <html> <head> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"></script> <style> table,thead,tr,th,tbody,tr,td{border: 1px solid;} </style> </head> <body> <label>Name : </label><input type="text" name="c_name" id="c_name"> </br></br> <label>Mobile : </label><input type="text" name="c_mobile" id="c_mobile"> </br></br> <button type="button" name="button" onclick="addinfo()">Add Info</button> </br></br> <table id="addinfo"> <thead> <tr> <th>Sr.</th> <th>Name</th> <th>Mobile</th> </tr> </thead> <tbody> </tbody> </table> </body> </html>