Create Jquery Array Of Droppable Elements
I got draggable li - elements and droppable boxes - using jQuery UI. My structure: A list of 3 permission types
- Create
Solution 1:
You can try this code:
var result = {};
$('ul.box').each(function () {
var type = $(this).attr('data-type');
var elements = [];
$(this).find('li').each(function () {
elements.push($(this).text());
});
result[type] = elements
});
Demo :http://jsfiddle.net/lotusgodkk/xw2djxdp/4/
Note: Click on the button and see the results in console
Post a Comment for "Create Jquery Array Of Droppable Elements"