Answers for "how to add character limit in html"

1

character limit html

<input type="text" id="username" name="username" maxlength="10">
Posted by: Guest on October-26-2021
2

limit input characters amount

<p><input placeholder="Title" id="input-title" class="text-input" maxlength="80" onkeyup="count_down(this)"  name="input" ></p>
      <span id="count" style="float: right; font-family: Raleway; font-size:20px; font-weight:600; margin-top:-5px;">80</span><br>

<script>
  function count_down(obj){

    let element = document.getElementById('count');

    element.innerHTML = 80 - obj.value.length;

    if(80 - obj.value.length < 5){
        element.style.color = "firebrick";
    }else{
        element.style.color = "#333";
    }
}
</script>
Posted by: Guest on June-16-2020

Code answers related to "how to add character limit in html"

Browse Popular Code Answers by Language