I really hope that you can help me. I have a simple jQuery character count script, that counts down when a user enters a character into a text field. However now I need to customize it in two ways:
1.) I need to add a checkbox. When this checkbox is checked
the character count has to be recuded by a certain amount e.g. 10 characters.
2.) The character count currently only shows when I start entering the first character, however I want the character count to show when the page loads.
If you have any questions please let me know.
Below you can find my code:
function countChar(val) {
var len = val.value.length;
if (len >= 500)
val.value = val.value.substring(0, 500);
else
$('#charNum').text(500 - len);
};
<textarea id="field" onkeyup="countChar(this)"></textarea>
<div id="charNum"></div>