Throughout, I am using this jQuery shuffle pluggin.
This is the situation. I have a <div class="masterDiv"> element containing many <span class="toBeShuffled"> elements. Each <span> element contains a <button> element. My goal is to shuffle the buttons properly.
Now my code is the following:
$(".masterDiv").find(".toBeShuffled").shuffle();
which does indeed shuffle the <span> elements, and hence also the <button> elements.
My problem is that, using .data(), I have attached information to the <button> elements, and this information disappears after the shuffle. How can I preserve the data I have attached?
reattach
.data()after.shuffle()-ing, oruse
.attr('data-something', 'value'), oruse html 5 custom data attribute