JSFiddle - React, Tailwind, and code Playground

by kthornbloom

HTML

<div class="crapbag">
testwrapper
  <div class="checkin checkin-highlighted" style="position:absolute; top:0; left:0;">
  test
  </div>
  <div class="checkin" style="position:absolute; top:0; left:200px;">
  test
  </div>
  <div class="checkin checkin-highlighted" style="position:absolute; top:0; left:200px;">
  test
  </div>
</div>

CSS

#enhance {
  color: red;
}

.checkin {
  width:200px;
  background:#ccc;
}

JavaScript

function checkDOMChange()
{
  console.log('checked');
  document.getElementsByClassName('checkin-highlighted')[0].parentElement.setAttribute("id", "enhance");
  var myel = document.getElementsByClassName('checkin-highlighted')[0];
  if (myel){
    console.log(myel);
  }
  
    setTimeout( checkDOMChange, 2000 );
}
checkDOMChange();