javascript - drag and drop get ids of multiple image in droppable -


i'm new jquery, there no question on this, wanted submit button able ids of multiple images in droppable, can help? please me or guide me along... need ids of image dragged inside droppable , when submit button pressed.. display image inside droppable..

jsfiddle

https://jsfiddle.net/xinfinityming/azvvhxvl/ 

javascript

$(function() { $("#dragicons img").draggable({   revert: "invalid",   refreshpositions: true,   cursor: "move",   cursorat: {     top: 56,     left: 56   },   drag: function(event, ui) {     ui.helper.removeclass("end-draggable");     ui.helper.addclass("draggable");   },   stop: function(event, ui) {     ui.helper.addclass("end-draggable");     ui.helper.removeclass("draggable");   } });  $("#briefcase-full").droppable({   greedy: true,   tolerance: 'touch',   drop: function(event, ui) {     var id = ui.draggable.attr("id");     alert(id);     if ($("#briefcase").length == 0) {       $("#briefcase-droppable").html("");     }        ui.draggable.addclass("dropped");       $("#briefcase-droppable").append(ui.draggable);     }   }); }); 

basically, dragged element go inside droppable. can use children check every elements.

$("#briefcase-droppable").children(".icons").each(function() { var icon_id= $(this).attr("id"); });

jsfiddle : link

i suggest use class instead of using img element attach draggable event.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo