JSFiddle - React, Tailwind, and code Playground

HTML

<span onclick="bigfont()">toggle font size</span>
<p>nanana</p>

CSS

[onclick] { cursor:pointer; }
.font1 { font-size:12px; }
.font2 { font-size:20px; }

JavaScript

var font_is_small = true;
document.body.className = 'font1';
function bigfont()
{
    font_is_small = !font_is_small; // switch the boolean
    if (font_is_small){
        document.body.className=
        document.body.className.replace("font1","font2");
    }
     else {
        document.body.className=
        document.body.className.replace("font2","font1");
    }
 }