JSFiddle - React, Tailwind, and code Playground

HTML

<p id="id1">ID 1</p>
<p id="id1">ID 1</p>

<button onclick="run()">Run</button>

CSS

#id1 {
  color: yellow;
}

JavaScript

function run() {
  const p = document.getElementById("id1")

  let randomColor = "#" + Math.floor(Math.random() * 16777215).toString(16);
  p.style.color = randomColor;

}