Seeking assistance with changing the text color multiple times from #627CA9 to #FFFFFF and vice versa.
Here's what I've tried:
function changeColor(id) {
var x = document.getElementById(id);
if (document.getElementById(id).style.color = "#627CA9")
document.getElementById(id).style.color = "#FFFFFF"
else {
document.getElementById(id).style.color = "#627CA9"; // forecolor
}
}
<div style="cursor: pointer;" onclick="changeColor('myid1'); return false;" id="myid1" class="centered">CHVRCHES</div>
<div style="cursor: pointer;" onclick="changeColor('myid2'); return false;" id="myid2" class="centered">PVRIS</div>
The color change script only executes once.
(Apologies for any language barriers)
Thank you.