22 lines
685 B
JavaScript
22 lines
685 B
JavaScript
function collectEditedData() {
|
|
const rows = document.querySelectorAll('tbody tr');
|
|
const assets = [];
|
|
|
|
rows.forEach(row => {
|
|
const cells = row.querySelectorAll('td');
|
|
assets.push({
|
|
assettag: cells[0].innerText,
|
|
hostname: cells[1].innerText,
|
|
warrantyfrom: cells[2].innerText,
|
|
status: cells[3].innerText,
|
|
staffnum: cells[4].innerText
|
|
});
|
|
});
|
|
|
|
// Add edited data to a hidden input
|
|
const input = document.createElement('input');
|
|
input.type = 'hidden';
|
|
input.name = 'assets';
|
|
input.value = JSON.stringify(assets);
|
|
document.querySelector('form').appendChild(input);
|
|
} |