JSFiddle - React, Tailwind, and code Playground
by KyleMuir
HTML
<input type="text" id="saveServer" />
<div id="yourname"></div>
<div id="error"></div>
JavaScript
function saveData() {
var input = document.getElementById("saveServer");
localStorage.setItem("server", input.value);
var serverValue = localStorage.getItem("server");
if (!serverValue) {
document.getElementById("error").innerHTML = "Oh dear! Nothing was found";
}
document.getElementById("yourname").innerHTML = "Okay " + (localStorage.getItem("server")) + " Let's get started! Push the button on the right to begin the story!";
}
saveData()