JSFiddle - React, Tailwind, and code Playground
by Ray Toal
HTML
<html>
<head>
<title>Dice Rolling</title>
</head>
<body>
<p>Hello</p>
<input type="text" id="sides" value="Goodbye">
<input
id="doomsdayButton"
type="button"
value="DO NOT PRESS"
style="background-color:red; color:yellow">
<script>
var changeDocumentColor = function () {
document.body.style.backgroundColor = document.getElementById("sides").value;
};
document.getElementById("doomsdayButton").onclick = changeDocumentColor;
document.getElementById("sides").onkeyup = function (e) {
if (e.keyCode === 13) {
changeDocumentColor();
}
}
</script>
</body>
</html>