JSFiddle - React, Tailwind, and code Playground

by SullysRants

HTML

<div id="displayer_show">
    <div class="demo" id="labels2-3">
        <input name="switch_show" type="checkbox" />Test
     </div>
</div>

JavaScript

$(function() {
  var data = localStorage.getItem("showning");
  if (data !== null) {
    $("input[name='switch_show']").attr("checked", "checked");
  }
});

$("input[name='switch_show']").click(function() {

  if ($(this).is(":checked")) {
    localStorage.setItem("showning", 1);
  } else {
    localStorage.removeItem("showning");
  }

});