[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1356
  • Last Modified:

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

Hi,

here is an example of Jquery Droppable demo with the source code I am trying to implement:
http://jqueryui.com/demos/droppable/#photo-manager

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.
0
NiconPhantom
Asked:
NiconPhantom
  • 6
1 Solution
 
NiconPhantomAuthor Commented:
Somebody?
0
 
blueghoztCommented:
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?
0
 
NiconPhantomAuthor Commented:
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 :-)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
NiconPhantomAuthor Commented:
P.S. Yes, it should be JS array )))
0
 
NiconPhantomAuthor Commented:
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>)?
0
 
NiconPhantomAuthor Commented:
Done! My solution is var IDs = [];$('#trash').find("li").each(function(){ IDs.push(this.id); });    
0
 
NiconPhantomAuthor Commented:
It takes time, but I did it ))))
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now