Change the font size using JavaScript for Web Accessibility

We will show how users can change font size of a webpage using JavaScript for Web Accessibility

<html>

<head>

<script>
function increaseFontSizeBy1px() {
   txt = document.getElementById("AA");
   style = window.getComputedStyle(txt, null).getPropertyValue("font-size");
   currentSize = parseFloat(style);
   txt.style.fontSize = (currentSize + 1) + “px”;
}
function decreaseFontSizeBy1px() {
   txt = document.getElementById("AA");
   style = window.getComputedStyle(txt, null).getPropertyValue("font-size");
   currentSize = parseFloat(style);
   txt.style.fontSize = (currentSize - 1) + “px”;
}
  </script> 

</head>

<body>

<div id="AA">

<a href="javascript:void(0);" aria-label="text Decrease" onclick="decreaseFontSizeBy1px()">A-</a>
<a  href="javascript:void(0);" aria-label="Text Default Size" onclick="location.reload();">A</a>
<a href="javascript:void(0);" onclick="increaseFontSizeBy1px()" aria-label="Text Increase">A+</a>

</div>

</body>

</html>