$(document).ready(function(){ // Initialize the editable-table functionality $('#usertable').editableTableWidget(); $('#btnnewuser').click(function() { var newUser = 'User' + String(Math.floor(Math.random() * Math.floor(9999))).padStart(4, '0'); $('#usertable tbody').append($('' + newUser + 'User0')); // Call `editableTableWidget()` again to include the newly added `` // To prevent recreating multiple new editors; reference the already existing `` $('#usertable').editableTableWidget({editor: $('#editor')}); }); });