Count Characters in Textarea using JavaScript | Onkeyup Function

preview_player
Показать описание
In this video tutorial, you will learn how to count characters in textarea using javascript.

Onkeyup function is used on textarea
Whenever a key is pressed , javascript function is called and length of textarea value is counted.

then count is checked with max no of characters, if length is smaller then you can write more letters
else only upto max characters is written and textrea value substring is passed in value

textarea
textarea class="form-control" id="description" style="height: 400px;" placeholder="Please write 100 words description" onkeyup="charCount(this)" /textarea


script
function charCount(textarea){
var max=100;
if( length greater than max)
{
}
else{
$('#textcount').text(max - length);
}

Count Characters in Textarea using JavaScript | Onkeyup Function

Stop user from entering maximun characters.

#javascript #knowledgethrusters
Рекомендации по теме
Комментарии
Автор

How to count only characters without counting line breaks or \n

alstentauro
join shbcf.ru