JSFiddle - React, Tailwind, and code Playground

HTML

<html>
<head>
<script>
function hello() {
     var ta = document.getElementById("test"),
         maxlength = ta.maxLength,
         value = ta.value,
         textToAppend = "hello";
      
     value += "hello";
     totalLen = value.length;
     if (totalLen>maxlength) {
         return false;
     }
     else {
         ta.value = value;
         return true;
     }
}
</script>
</head>
<body>
<textarea id="test" rows="4" cols="50" maxlength="50">
</textarea>
<button onclick="hello();"> Click </button>
</body>
</html>