Is there a way (jQuery is fine, but not essential) to get all the data- attributes on a page and then change the values in the element's class to those in the data- attribute?
E.g.
this:
Code:
<div class="class1 class 2">
A
</div>
<div class="class1 class 2" data-class-override="class3 class 4">
B
</div>
<div class="class1 class 2">
C
</div>
...becomes:
Code:
<div class="class1 class 2">
A
</div>
<div class="class3 class 4">
B
</div>
<div class="class1 class 2">
C
</div>
I need it to search the entire page as they could be anywhere.
I know $(this).data("class-override") would get it but how search the whole page and how do it in the best way?