Forming a JSON of Elements Contained in Sortable
I have a sortable that contains several elements (div's, with unique id's). Inside those div's, I have an image, a few buttons and a few text labels.
What I would like to do is collect some data from those elements into a JSON. For instance, the "name" attribute can be assigned the id property from the parent div. I am also interested in the position of that div within sortable. Hence, an attribute called "position" can probably refer to that. After that, I would need to know the "value" attribute of one of the buttons (it changes, depending on whether this). That is the idea. However, I am unsure of how to proceed.
Thus far, I have discovered the Sortable method which gives me an array of "id"s from the parent div's.
How can I use this or some other method to get what I need?
On another note, is there a way to do a reverse task of populating a sortable from a JSON that contains the information specified above?