(Tips) Adding A Javascript Counter To Your Drupal Forms
Tips : Adding A Javascript Counter To Your Drupal Forms
if you want to add a javascript counter (n characters remaining) to your drupal forms, you can do the following ; (jquery code based very heavily on the jquery tricks on reindel.com)
1. add two new classes to your text area
add two new css classes to your text area i.e.countdownand a limit specification (for how many characters you want to limit to.
<textarea cols="40" rows="4" name="title" id="edit-title" value="" class="form-text required countdown limit_100_"></textarea>2. create a span where you want your n remaining characters to go
<textarea cols="40" rows="4" name="title" id="edit-title" value="" class="form-text required countdown limit_100_"></textarea>
<br />
<span class="remaining"><!-- --></span>
Courtesy : Johnandcailin.com
- guru's blog
- Login to post comments
![Drupal-6-Book-[Building Powerful and Robust Websites with Drupal 6].jpg](http://www.drupalranch.com/images/Drupal-6-Book-[Building%20Powerful%20and%20Robust%20Websites%20with%20Drupal%206].jpg)