1<p><input placeholder="Title" id="input-title" class="text-input" maxlength="80" onkeyup="count_down(this)" name="input" ></p>
2 <span id="count" style="float: right; font-family: Raleway; font-size:20px; font-weight:600; margin-top:-5px;">80</span><br>
3
4<script>
5 function count_down(obj){
6
7 let element = document.getElementById('count');
8
9 element.innerHTML = 80 - obj.value.length;
10
11 if(80 - obj.value.length < 5){
12 element.style.color = "firebrick";
13 }else{
14 element.style.color = "#333";
15 }
16}
17</script>
1<input name="somename"
2 oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
3 type = "number"
4 maxlength = "6"
5 />