write a java script code that does't exceed the maximum numbers of characters that you want to accept in text area.

 write a java script code that does't exceed the maximum numbers of characters that you want to accept in text area.


CODE:
<!DOCTYPE html>
<html>
<body>

Address:<br>
<textarea id="myTextarea" maxlength="30">
342 Alvin Road
Ducksburg</textarea>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myTextarea").maxLength;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Comments