I want to show the user how many characters they have typed in the text box.
Pretty simple solution, with a few assumptions: 1. you load javascript functions 2. users have modern browsers
On the text box use this code:
onkeyup="charcountupdate(this.value)"
After the text box, add this where you want to display the counter:
<span id=charcount></span>
(can also use div instead of span)
And on the javascript file add these lines:
function charcountupdate(str){
var lng = str.length;
document.getElementById("charcount").innerHTML = lng + ' out of xxx characters';
}
see my example: http://codepen.io/borisplotkin/pen/RPwXeK
Hope this helps.
FavScripts.com is a free tool to save your favorite scripts and commands, then quickly find and copy-paste your commands with just few clicks.
Boost your productivity with FavScripts.com!