Is there a way (jQuery is fine) 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:
...becomes: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>
I need it to search the entire page as they could be anywhere.Code:<div class="class1 class 2"> A </div> <div class="class3 class 4"> B </div> <div class="class1 class 2"> C </div>
I know $(this).data("class-override") would get it but how search the whole page and how do it in the best way?



Reply With Quote


Bookmarks