<div class="col-md-4">
@Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control"} })
@Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
<div id="cnt" style="color:red;"></div>
</div>
JAVASCRIPT:-
$("#Title").keyup(function () {
var lenCount = document.getElementById('Title');
var count = 145 - lenCount.value.length;
document.getElementById('cnt').innerHTML = count + ' ' + 'Character Remaining';
I DO This But It Not Work:-
if (count >= 28) {
document.getElementById("cnt").style.color = "#ff0000";
}
if (count == 145) {
$("#cnt").html('');
}
});