The reset of html elements list with more than 5 entries

Posted on 2016-08-09
Last Modified: 2016-08-15
Hello everyone,

I using jquery to delete list Elements.

If i want to delete more als 5 Elements, can Become the first no longer deleted .
 done: function (e, data) {
                    $('#fileupload').prop("disabled", false);
                    $('#senden').prop("disabled", false);
                    $.each(data.result.files, function (index, file) {
                        id =" ", "");
                        id = id.replace(/[^a-zA-Z0-9]/g, '_');
                        id = id.replace("_", "");
                        $('#progress .bar').text("");
                        $('<ul>').html("<li id='li" + id + "' ><tr ><td><a id='" + id + "' class='ui-btn ui-icon-delete ui-btn-icon-left'>" + + "</a></td></tr></li>").appendTo("#datalist");

                        deletefile(, id);



Open in new window

   function deletefile(name, id)
            $('#' + id).click(function () {
                $.post("obcctransfer.php", {ceck: "delete", id: name}, function (data) {
                    $('#li' + id).html("");
                    if ($('#li' + id).length) {
                        alert("Das DIV mit der ID '#li' + id existiert");

Open in new window

Question by:obcc-srs
  • 2

Expert Comment

by:James Bilous
ID: 41748871
I'm having trouble understanding this part of your question:

If i want to delete more als 5 Elements, can Become the first no longer deleted .

Are you saying that when your done callback function is called with more than 5 elements in the data.results.file property, all but one of the list items in your html are removed?

Accepted Solution

obcc-srs earned 0 total points
ID: 41748995
done callback is execuded after every uploaded file.
in there it initialize these function deletefile().

And in there  "$('#li' + id).html("");" Do not reset the first and second entry. If that all was more than 5 times running. The IDs are available

Author Closing Comment

ID: 41756115
I made ​​the mistake self dissolved

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now