I have a textarea
that word count is limited to a maximum of 500. I want to check the word count value greater than 500 then show an error message below of that textarea
Now I got the correct word count but how to show the error message and stop to entering values.
html
<div class="">
<div class="form-control-wrapper">
<textarea name="project_desc" id="project_desc" class="form-control project_desc" rows="6"><?php if(isset($project_desc)){ echo $project_desc; }?></textarea>
</div>
</div>
jquery
$('#project_desc').keyup(function(e){
var value = $('#project_desc').val();
var length = value.trim().replace(/[\s]+/g, " ").split(" ").length;
if(length >= 500)
{
//show an error message ans stop entering values
}
});