Ich habe bei mir dass Problem dass die list Elemente bei ca. mehr als 5 Elementen die ersten nicht mehr gelöscht werden.
Die Element werden erkannt im Backend ebenfalls gelöscht nur $(#"idname").html("") wird nicht zurückgesetzt.
Code:
done: function (e, data) { $('#fileupload').prop("disabled", false); $('#senden').prop("disabled", false); $.each(data.result.files, function (index, file) { id = file.name.replace(" ", ""); id = id.replace(/[^a-zA-Z0-9]/g, '_'); id = id.replace("_", ""); $('#progress .bar').text(""); $('
- ').html("
- " + file.name + "
- ").appendTo("#datalist"); deletefile(file.name, id); console.log(id); }); },
Code:
function deletefile(name, id) { $('#' + id).click(function () { $.post("transfer.php", {ceck: "delete", id: name}, function (data) { $('#li' + id).html(""); if ($('#li' + id).length) { alert("Das DIV mit der ID '#li' + id existiert"); alert(id); } console.log(id); }); }); }
Kommentar