From a5b13dad7a3dda4460e3589aadaa0bae73ca1e31 Mon Sep 17 00:00:00 2001 From: Andrew Lorimer Date: Sat, 17 Aug 2019 23:35:13 +1000 Subject: [PATCH] fix event listener bug for items & add buttons --- admin.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/admin.js b/admin.js index 224e692..ea20d86 100644 --- a/admin.js +++ b/admin.js @@ -168,6 +168,7 @@ function drop(e) { dragSrcEl.innerHTML = this.innerHTML; this.innerHTML = e.dataTransfer.getData('text/html'); save(); + menu(); } return false; } @@ -314,7 +315,7 @@ function listen(li) { } else { addItem(r, li); } - }, false); + }, true); } function addItem(caller, li) { @@ -380,12 +381,14 @@ function addItem(caller, li) { span.onmouseout = function() { this.style.background = hoverbg2; }; + menu(); // TODO fix bug where form save button loses its eventlistener after generating form for another column twice fields = document.querySelector("#"+id+" .new .name"); fields.focus(); } function menu() { + // Update event listeners for all items, their remove buttons, and the add button for each column var allUserLi = document.querySelectorAll('.remove, .add'); allUserLi.forEach(function(li, p_index){ -- 2.47.1