Problem:
The issue here is that the user wanted to limit the amount of characters in their form field.
Solution:
This can be done by using the code in the example below.
jQuery(document).ready(function ($) { $('[name^=post_excerpt]').attr('maxlength',280); }); ( function( $ ) { $( document ).ready( function(){ // insert div to display char count $('textarea[name="post_excerpt"]').after("<div class='char-count'>0</div>"); // listen for keyup and update the count $('textarea[name="post_excerpt"]').keyup( function(){ var chars = $('textarea[name="post_excerpt"]').val().length; $('.char-count').html( chars ); }); }); })( jQuery );
To display the counter you will need to add a p tag to your form with the class "char-count"
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
This topic contains 6 replies, has 3 voices.
Last updated by 5 years, 10 months ago.
Assisted by: Shane.