diff options
Diffstat (limited to 'rannak/mangud/partorg/plakat/script.js')
-rw-r--r-- | rannak/mangud/partorg/plakat/script.js | 8 |
1 files changed, 5 insertions, 3 deletions
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(); |