My code calls for pasting a data string into input text area. Then you press a button and it puts the data into a more easy to read editable table. Then when I edit some of the data, I press the save button and it is supposed to move the edited text into the output text field, and then i press a "save to file" button. But when i press the first save button to move it to the output text area, it just puts the orginal string in the ouput text area. instead of the edited data. Here is the save function or the code. Can anyone see any errors or have any suggestions? Thanks!
Code:
function saveChanges() {
const tableRows = document.getElementById("result").getElementsByTagName("tr");
let newTSL = document.getElementById("tslInput").value;
for (const row of tableRows) {
const title = row.cells[0].textContent;
const settingsInputs = row.cells[1].getElementsByTagName("input");
const settings = Array.from(settingsInputs).map(input => input.value.toUpperCase());
const pattern = new RegExp(`%${title}\\["([0-9A-F]{2}",?)+`, "i");
const match = pattern.exec(newTSL);
if (match) {
const settingsText = settings.join('","');
newTSL = newTSL.substring(0, match.index) + `%${title}["${settingsText}"` + newTSL.substring(match.index + match[0].length - 1);
}
}
document.getElementById("tslOutput").value = newTSL;
}