JSFiddle - React, Tailwind, and code Playground

by tjdragon

HTML

<a href="#" id="increment">Increment</a>
<a href="#" id="decrease">Decrease</a>
<p>
something something
</p>

JavaScript

$("#increment").click(function(){
    resizeText(1);
});

$("#decrease").click(function(){
    resizeText(-1);
});

function resizeText(multiplier) {
var p = $("p")[0];
  if (p.style.fontSize == "") {
    p.style.fontSize = "1.0em";
  }
    
  p.style.fontSize = parseFloat(p.style.fontSize) + (multiplier * 0.2) + "em";
}