Jquery Droppable (Simple photo manager) - how to create an array of items in trash?

Posted on 2011-04-20
Last Modified: 2012-05-11

here is an example of Jquery Droppable demo with the source code I am trying to implement:

I'd like to know how can I create an array of all items in trash?

Actually if somebody have an easy example of jquery Droppable with possibility to add images to div and then to create array it's also good solution for me )))

If any additional information will be required, please let me know and I'll immediately answer.
Question by:NiconPhantom

    Author Comment

    LVL 6

    Expert Comment

    sounds like you are asking for what the demo does already... but when you say an 'array' do you mean a JavaScript array? are you looking for AJAX solutions?

    Author Comment

    Hi Blueghozt,

    To be more specific, yes, the default functionality is ok for me, the only difference is that I'll replace the trash with the list of acceptable objects. All I need to do is to somehow create an array of all abjects inserted to "trash". Definitely I'll post an array with ajax function to my php controller on submit, but I am able to create the function like that. The only problem which I can't resolve - array creation which should contain all elements in trash. My idea is to add id attribute to <li> in style <li id="id of image"> and it's already implemented with php. No mather will I use src attribute of <img> tag or an id attr of <li> tag, the key poin is to have an array :-)

    Author Comment

    P.S. Yes, it should be JS array )))

    Author Comment

    I have found that I can use something like:

    alert($('#trash li').get());

    It returns an array of all <li> items located in trash, but how can I return array of id attributed only (<li class="test" id="234">Bla bla</li>)?

    Accepted Solution

    Done! My solution is var IDs = [];$('#trash').find("li").each(function(){ IDs.push(; });    

    Author Closing Comment

    It takes time, but I did it ))))

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 Specialist

    HTML5 development skills are critical to all developers. HTML5 is the foundation to almost any development process. That's why business, design studios, development shops and other organizations need HTML5 developers. Get your foot in the door as a HTML5 specialist.

    Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
    Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
    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…

    794 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

    16 Experts available now in Live!

    Get 1:1 Help Now