From deb4edef43ca3c958dca3dfd42bd9b50e1e317e9 Mon Sep 17 00:00:00 2001 From: mic Date: Wed, 17 Jul 2024 00:08:14 +0200 Subject: [PATCH] correctly handling enable checkbox to enable the saveall button. see #65 --- customprompts/mzta-custom-prompts.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/customprompts/mzta-custom-prompts.js b/customprompts/mzta-custom-prompts.js index 1a9c1f97..779b59e1 100644 --- a/customprompts/mzta-custom-prompts.js +++ b/customprompts/mzta-custom-prompts.js @@ -58,15 +58,6 @@ document.addEventListener('DOMContentLoaded', async () => { } btnNew.addEventListener('click', handleNewClick); - // Enable save button on input change - function handleInputChange(e) { - e.preventDefault(); - setSomethingChanged(); - } - document.querySelectorAll('.input_mod').forEach(element => { - element.addEventListener('change', handleInputChange); - }); - // Display selected value next to select input // function handleSelectChange(e) { // e.preventDefault(); @@ -352,6 +343,12 @@ function handleCheckboxChange(e) { //console.log('>>>>>>>> checked_val: ' + e.target.getAttribute('checked_val')); } +// Enable save button on input change +function handleInputChange(e) { + e.preventDefault(); + setSomethingChanged(); +} + //========= handling an item in a row - END @@ -461,6 +458,10 @@ function loadPromptsList(values){ checkbox_elements.forEach(element => { element.addEventListener('change', handleCheckboxChange); }); + + document.querySelectorAll('.input_mod').forEach(element => { + element.addEventListener('change', handleInputChange); + }); } function checkFields() {