JSFiddle - React, Tailwind, and code Playground

by Chris Rebert

HTML

<input type="text" value="Some text" id="foo" />
<input type="checkbox" id="bar" />
<p>The above text input should NOT be blue, and the checkbox should be unchecked.</p>
<h1 id="status"></h1>

CSS

input[disabled] {
    background-color: blue;
    color: white;
}

JavaScript

var foo = document.getElementById("foo");
var bar = document.getElementById("bar");
if (localStorage.getItem('reloaded')) {
    localStorage.removeItem('reloaded');
    document.getElementById('status').textContent = "Done.";
}
else {
    foo.setAttribute('disabled', '');
    bar.checked = true;
    localStorage.setItem('reloaded', 'true');
    window.location.reload();
}