Compare Page Revisions
« Older Revision - Back to Page History - Newer Revision »
<input type='text' maxlength='50' id='FirstName' /> <div id='FirstNameCharsLeft'></div>
/*------------------------------------------------------------------------------------------------*/ $(document).ready(function(){ setInterval("timerClick()", 300); }); /*------------------------------------------------------------------------------------------------*/ function timerClick(){ showCharsLeft('#FirstName', '#FirstNameCharsLeft'); } /*------------------------------------------------------------------------------------------------*/ function showCharsLeft(inputSelector, outputSelector) { var inputField = $(inputSelector); var maxLength = inputField.attr('maxlength'); if (maxLength != undefined) { var length = inputField.val().length; var charsLeft = maxLength - length; $(outputSelector).html(charsLeft + " character(s) left"); } } /*------------------------------------------------------------------------------------------------*/
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.