// Add event listeners to existing edit and delete buttons in dummy data
document.querySelectorAll('.edit').forEach((button) => {
    button.onclick = function() {
        const row = button.closest('tr');
        const fullName = row.cells[0].textContent;
        const age = row.cells[1].textContent;
        const grade = row.cells[2].textContent;
        const school = row.cells[3].textContent;
        const district = row.cells[4].textContent;
        const category = row.cells[5].textContent;

        const newFullName = prompt("Edit Full Name:", fullName);
        const newAge = prompt("Edit Age:", age);
        const newGrade = prompt("Edit Grade:", grade);
        const newSchool = prompt("Edit School:", school);
        const newDistrict = prompt("Edit District:", district);
        const newCategory = prompt("Edit Category:", category);

        if (newFullName && newAge && newGrade && newSchool && newDistrict && newCategory) {
            row.cells[0].textContent = newFullName;
            row.cells[1].textContent = newAge;
            row.cells[2].textContent = newGrade;
            row.cells[3].textContent = newSchool;
            row.cells[4].textContent = newDistrict;
            row.cells[5].textContent = newCategory;
        }
    };
});

document.querySelectorAll('.delete').forEach((button) => {
    button.onclick = function() {
        const row = button.closest('tr');
        row.parentNode.removeChild(row);
    };
});