JSFiddle - React, Tailwind, and code Playground
HTML
<!doctype html>
<html>
<head>
<title>My website</title>
</head>
<body>
<button id="counter">count: 0</h1>
<script src="script.js"></script>
</body>
</html>
JavaScript
let count = 0;
let buttonElement = document.getElementById('counter');
function incrementCounter() {
count += 1;
buttonElement.innerText = `count: ${count}`;
}
buttonElement.addEventListener('click', incrementCounter);