From de7dc499eedd65ae94e6b961f7665ea985d0dff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sat, 1 Apr 2023 11:07:33 +0200 Subject: [PATCH] fix cleanup bug --- index.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index 9a9cc79..7a858ba 100644 --- a/index.js +++ b/index.js @@ -14,10 +14,12 @@ let words = [ ]; function makeSpaceWord(word){ + $("#lettersky").html(""); + $("#imagesky").html(""); let length = word.length; for (var i = 0; i < length; i++) { - $("#lettersky").append('
'); - $("#imagesky").append('
'); + $("#lettersky").append('
'); + $("#imagesky").append('
'); } $("#lettersky").append('
'); $("#imagesky").append('
'); @@ -26,16 +28,18 @@ function makeSpaceWord(word){ let prefix = "assets/"; function cleanup(){ - var htmls = []; - var returntos = []; - $("[returnto]").each(function (index){ - htmls.push($(this).prop("outerHTML")); - returntos.push($(this).attr("returnto")); - $(this).remove(); - }); - for (var x = 0 ; x < returntos.length; x++) { - //$('[returntarget="' + returntos[x] + '"]').html(htmls[x]); - } + // var htmls = []; + // var returntos = []; + // $("[returnto]").each(function (index){ + // htmls.push($(this).prop("outerHTML")); + // returntos.push($(this).attr("returnto")); + // $(this).remove(); + // }); + // for (var x = 0 ; x < returntos.length; x++) { + // //$('[returntarget="' + returntos[x] + '"]').html(htmls[x]); + // } + + $(".finalplace").html(""); } function checkAnswers() {