JSFiddle - React, Tailwind, and code Playground
HTML
<button id="groter">Groter</button>
<button id="kleiner">Kleiner</button>
<p>
Een stuk tekst
</p>
JavaScript
function TextSize()
{
var size = 16;
var obj = {};
obj.bigger = function()
{
size++;
document.body.style.fontSize = size + 'px';
}
obj.smaller = function()
{
size--;
document.body.style.fontSize = size + 'px';
}
return obj;
}
var textSize = TextSize();
document.getElementById('groter').onclick = textSize.bigger;
document.getElementById('kleiner').onclick = textSize.smaller;