School Commit Init

This commit is contained in:
2024-08-31 12:07:21 +03:00
commit 0b130ee18c
2801 changed files with 4720552 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
$(document).ready(function() {
$('#dynamic-table').on('click', '.delete-row', function() {
$(this).closest('tr').remove();
});
$('#dynamic-table').on('click', '.add-row', function() {
var newRow = '<tr><td><button class="delete-row">Delete</button></td>';
for (var i = 0; i < 5; i++) {
newRow += '<td contenteditable="true"></td>';
}
newRow += '<td><button class="add-row">Add</button></td></tr>';
$(this).closest('tr').after(newRow);
});
$(document).ready(function(){
$('td').focus(function(){
$('td').removeClass();
$(this).toggleClass('focus');
});
});
$('#dynamic-table').on('focus', 'td[contenteditable="true"]', function() {
var filled = true;
$(this).closest('tr').find('td[contenteditable="true"]').each(function() {
if ($(this).text().trim() === '' || $(this).hasClass("focus")) {
filled = false;
return false;
}
});
if (filled) {
$(this).closest('tr').find('td[contenteditable="true"]').prop('contenteditable', false);
}
});
});