JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>q</title>
	<script>
		var n = 0;

		function buttonPress(a) {
			var buttonn = document.getElementById('hello' + a);
			if (n !== a) {
				buttonn.style.background = "#FF0000";
				if (n !== 0) {
					var buttonn = document.getElementById('hello' + n);
					buttonn.style.background = "#00FF00";
				}
				n = a;
			}
			else {
				buttonn.style.background = "#00FF00";
				n = 0;
			}
		}
		
	</script>
</head>

<body>
	<input id="hello1" type="submit" value="hello" onmousedown="buttonPress(1);" style="background:#00FF00" />
	<input id="hello2" type="submit" value="hello" onmousedown="buttonPress(2);" style="background:#00FF00" />
</body>

</html>