JSFiddle - React, Tailwind, and code Playground
by igalst
JavaScript
$("#foo").toggleClass("bar", Math.random() < 0.5);
// vs.
var foo = $("$foo"); // or document.getElementById("foo");
foo.className = Math.random() < 0.5 ? "bar" : "";
by igalst
$("#foo").toggleClass("bar", Math.random() < 0.5);
// vs.
var foo = $("$foo"); // or document.getElementById("foo");
foo.className = Math.random() < 0.5 ? "bar" : "";