JSFiddle - React, Tailwind, and code Playground

by envira

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.0/jquery.cookie.min.js"></script>
<body> 
<button id="grey">Grey</button>
<button id="red">Red</button>
<button id="pink">Pink</button>
<button id="blue">Blue</button>
<button id="green">Green</button>
<button id="yellow">Yellow</button>
<button id="orange">Orange</button> 
</body>

JavaScript

$(document).ready(function() {
$("body").css("background", $.cookie("bg-color"));

$("button#grey").click(function() {
$("body").css("background", "#111")
$.cookie("bg-color", "#111")
});
                       
$("button#red").click(function() {
$("body").css("background", "red")
$.cookie("bg-color", "red")
});
                      
$("button#pink").click(function() {
$("body").css("background", "pink")
$.cookie("bg-color", "pink")
});
                       
$("button#blue").click(function() {
$("body").css("background", "blue")
$.cookie("bg-color", "blue")
});
                       
$("button#green").click(function() {
$("body").css("background", "green")
$.cookie("bg-color", "green")
});
                        
$("button#yellow").click(function() {
$("body").css("background", "yellow")
$.cookie("bg-color", "yellow")
});
                         
$("button#orange").click(function() {
$("body").css("background", "orange")
$.cookie("bg-color", "orange")
});
                         
});