Untitled

 avatar
unknown
javascript
a year ago
319 B
5
Indexable
const content = document.getElementById("content");
const button = document.getElementById("font-toggle");
let fontSize = 16; // Initial font size

button.addEventListener("click", function() {
  if (fontSize === 16) {
    fontSize = 20;
  } else {
    fontSize = 16;
  }
  content.style.fontSize = fontSize + "px";
});
Editor is loading...
Leave a Comment