add word count in a wp_editor
-
Hello, I use this function to add a character count to wp_editor but doesn’t work. If I use it on the excepert editor with #excerpt instead of #descrizione_serivizio_texta every works fine but if I use in a wp_editor with id=”descrizione_serivizio_texta” I see the count but it doesn’t update while wirting.
add_action( 'admin_print_footer_scripts', 'check_textarea_length_servizio_riassunto' ); function check_textarea_length_servizio_riassunto() { ?> <script type="text/javascript"> jQuery( document ).ready( function($) { $('#descrizione_serivizio_texta').on('keyup', function () { var char_count = $(this).val().length; // Update the character count on every key up $('#excerpt-wc span.ch').text(char_count); }).after('<p id="excerpt-wc">NUMERO DI CARATTERI: <span class="ch">0</span></p>'); // Set the initial symbol count on page load var char_count = $('#descrizione_serivizio_texta').val().length; $('#excerpt-wc span.ch').text(char_count); }); </script> <?php }
Any suggestions?
Thanks
- The topic ‘add word count in a wp_editor’ is closed to new replies.