Dynamically change all White to Black and Reverse

Anybody got an idea on how to dynamically change every tag attribute on a page that has “white” as the value to “black” and every tag with an attribute value of black to “white”? This change is all conditioned on a value in the mapped record object.

I also need to change one or more CSS classes.

I would try to run a script that uses the Selector body.

Then, in the script the following:

var myHTML = results.html().toString();

myHTML = myHTML.replace(/black/g,“toWHITE”);
myHTML = myHTML.replace(/white/g,“black”);
myHTML = myHTML.replace(/toWHITE/g,“white”);

results.html(myHTML);

1 Like