" +
+ "
" +
"
" +
"
"
);
@@ -161,7 +185,32 @@ function showImages() {
letterholder.append(value);
});
- $(".imageholderak").each(function(){
+ $(".originalplace").on("click", function(e){
+ let targetElement = $(this);
+ if (targetElement.hasClass("imageholderak")){
+ let [emptyindex, idcko] = getEmptyIndex($(".finalimageplace"), this);
+ if (emptyindex > -1){
+ let changingelement = $("#" + idcko);
+ changingelement.html(targetElement.html());
+ }
+
+ }
+
+ if (targetElement.hasClass("letterholderak")){
+ let [emptyindex, idcko] = getEmptyIndex($(".finalletterplace"), this);
+ if (emptyindex > -1){
+ let changingelement = $("#" + idcko);
+ changingelement.html(targetElement.html());
+ }
+
+ }
+ });
+
+ $(".finalplace").on("click", function (){
+ $(this).html("");
+ });
+
+ $(".imageholderak, .letterholderak").each(function(){
$(this).on("click", function (e){
let datacode = $(this).attr("datacode");
document.getElementById("audplay"+ datacode).play();
@@ -284,9 +333,9 @@ function drop(ev) {
function droptrash(ev) {
ev.preventDefault();
let cntdragx = ev.dataTransfer.getData("cntdrag");
- //$('[cntdrag="' + cntdragx + '"]').remove();
+ $('[cntdrag="' + cntdragx + '"]').remove();
let htmldata = ev.dataTransfer.getData("text");
let returnto = ev.dataTransfer.getData("returnto");
- //$('[returntarget="' + returnto + '"]').html(htmldata);
+ $('[returntarget="' + returnto + '"]').html(htmldata);
}