JSFiddle - React, Tailwind, and code Playground

by DeadByElpy

HTML

<p id="cls">
  asdsadsad
</p>
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
  <div>5</div>

CSS

div {
  width: 200px;height: 100px;
  background-color: grey;
}

div:nth-child(even) {
  background-color: #0ff;
}

JavaScript

const divs = document.querySelectorAll('div');

const handleTouchStart = e => {
window.cls.textContent += e.target;
  e.target.textContent = Date.now();
};

divs.forEach(div => (e.addEventListener('touchstart', handleTouchStart)));