I love Gravity Forms, it’s one of my go-to plugins for all WordPress installs. Last week a client gave me the form fields for a new form and some of them needed a word counter to limit words to 300 in textareas. I found two possible solutions for adding maximum word count in Gravity Forms after a bit of searching, but neither worked for me (not being a programmer, I didn’t know how to fix them). But my programmer friends at CodeGeek stepped in and came up with this solution.

Here’s the Javascript which is saved in /themes/mytheme/js/ (it could also be put in an HTML block within the form itself, but we may want to use it on several other forms so made it available site-wide):

Then in functions.php, call the script:

Then in the Gravity Form for fields that need the word count, add the class ‘els-word-count[300]’ in the Advanced tab for CSS Class Name. Change [300] as needed for the maximum words that can be added to that particular field.