$(document).ready(function(){ // Initialize the editable-table functionality $('#usertable').editableTableWidget(); $('#usertable button.delete').click(function() { $(this).closest('tr').addClass('removed'); }); $('#btnnewuser').click(function() { // Create a new user; generate pseudo-random username var newUser = 'User' + String(Math.floor(Math.random() * Math.floor(9999))).padStart(4, '0'); // Add new user to the interface // (new `
', { text: newUser })) .append($(' | ', { text: 'User' })) .append($(' | ', { class: 'immutable', html: ' ' + '' })) ); // Call `editableTableWidget()` again to include the newly added ` |