<textarea id="field" onkeyup="countChar(this)"></textarea> <div><span id="charNum">50</span> words remining</div>
function countChar(val) { var len = val.value.length; if (len >= 50) { val.value = val.value.substring(0, 50); } else { $('#charNum').text(50 - len); } };
Jagdish Sarma Asked question December 28, 2020