Saturday, October 26, 2024

Character Counter using javascript

 Max 25 Chars only<br>

<textarea id = "counts"></textarea><br><br>
<div id = "show">0</div>

<script>
    var c = document.getElementById("counts");

    c.oninput = function(){
        var st = c.value;
         if(st.length>=25){
            document.getElementById("show").innerHTML = "Please stop you reached at maximum limit.";
            return false;
        }
        else{
            document.getElementById("show").innerHTML = st.length;
        }
    }
</script>

No comments:

Post a Comment

How to Add AI to Your Website

index.php file <form method = "POST" action = "chat.php" >     <input type = "text" name = "...