From ac3bfb7728e9324e6a21035e7b321649550c60cb Mon Sep 17 00:00:00 2001 From: Rasmus Date: Sat, 10 Jun 2023 16:45:12 +0300 Subject: finalFixes Former-commit-id: 7fcc5cc7033804bb7e56b0ce5d3d77a6c2413236 --- rannak/mangud/partorg/plakat/script.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'rannak/mangud/partorg/plakat/script.js') diff --git a/rannak/mangud/partorg/plakat/script.js b/rannak/mangud/partorg/plakat/script.js index 7b19edd..1435d10 100644 --- a/rannak/mangud/partorg/plakat/script.js +++ b/rannak/mangud/partorg/plakat/script.js @@ -15,38 +15,40 @@ let newTextBtns = document.querySelectorAll(".muuda"); newTextBtns.forEach(btn => { btn.addEventListener("click" , e => { + console.log("clicked"); for (el of e.target.parentElement.parentElement.childNodes[1].childNodes) { - console.log(el); if (el.classList != undefined && el.classList.contains("addedText")){ el.classList.remove("addedText"); - console.log('dingdong'); } } let inputText = e.target.parentElement.childNodes[5].value; + let mySpan = document.createElement('span'); mySpan.classList.add('addedText'); mySpan.classList.add('oldAddedText'); mySpan.innerHTML = inputText; + let parentEl= e.target.parentElement.parentElement.childNodes[1]; parentEl.appendChild(mySpan); mySpan.style.top = "50%"; mySpan.style.left = "35%"; - e.target.parentElement.childNodes[5].value = ''; + e.target.parentElement.childNodes[5].value = ''; if (!addedTexts.includes(parentEl.classList[1])) addedTexts.push(parentEl.classList[1]); + // Check If Done if (addedTexts.length >= 4) checkIfAllGood(); -- cgit v1.2.3