JSFiddle - React, Tailwind, and code Playground

by K.J Ye

HTML

<a href="example1.com"> innerHTML1 </a>
<a href="example2.com"> innerHTML2 </a>
<a href="example3.com"> innerHTML3 </a>

CSS

/* make this look a bit more visible */
a{
  display: block;
}

.gotcha{
  color: red;
}

JavaScript

var myEles = document.getElementsByTagName('a');
for(var i=0; i<myEles.length; i++){
    if(myEles[i].innerHTML == ' innerHTML2 '){
         console.log('gotcha'); 
         
         //use javascript to style
         myEles[i].setAttribute('class', "gotcha");
    }
}