13 lines
661 B
JavaScript
13 lines
661 B
JavaScript
$(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($('<tr><td>' + newUser + '</td><td>User</td><td class="immutable"><a href="?">0</a></td></tr>'));
|
|
// Call `editableTableWidget()` again to include the newly added `<tr>`
|
|
// To prevent recreating multiple new editors; reference the already existing `<input>`
|
|
$('#usertable').editableTableWidget({editor: $('#editor')});
|
|
});
|
|
}); |