I need to copy data values from one element to another, but jQuery's clone() method doesn't clone the data. And I can't iterate over the data either:
element.data().each
because data() is a function and not a jQuery object. It seems I have to keep a separate list of attribute names and reference those but that seems too hacky. So how can I do either of these:
a) Iterate over data items
OR
b) clone() an element with its data.