Count characters left in field dynamically using javascript and jquery
If you want to count number of characters left in your filed you can use my simple code.
<textarea maxlength="410" name="about_me" onkeydown="CountLeft(this.form.about_me, this.form.left);" onkeyup="CountLeft(this.form.about_me,this.form.left); "></textarea> <input maxlength="3" name="left" readonly="" size="3" type="text" value="410" /> characters left <script> function CountLeft(field, count) { var max = "410"; if (field.value.length > max) { field.value = field.value.substring(0, max); } else { count.value = max - field.value.length; } } </script>
Please support us, Like us on Facebook.
Subscribe to:
Post Comments (Atom)
Thank you for the solution :)
ReplyDeleteVisit Us : Magento Ecommerce Development India