-
editorialnevadadailymailAsked on October 2, 2025 at 2:30 PM
I know this topic has been beaten to death. And, I see that Jotform does have a word count for the Short Text and Long Text elements. Nice.
However, I would like this to be accessible to the conditionals, so we can change prices based on word count. This is for a newspaper that accepts forms like obituaries that charges based on word count.
Any JavaScript that can be embedded into the webpage to expose this variable would be helpful.
Many thanks in advance!
MAJ
-
Kyle JotForm SupportReplied on October 2, 2025 at 2:59 PM
Hi MAJ,
Thanks for reaching out to Jotform Support. Unfortunately, native conditionals can’t evaluate word count directly. But if you’re embedding the form on your own site, you can use custom JavaScript to calculate word count and pass it into a hidden field. That hidden field can then be used in your conditional logic.
<script>
document.addEventListener("DOMContentLoaded", function() {
const textField = document.querySelector('[name="yourTextFieldName"]');
const wordCountField = document.querySelector('[name="yourHiddenWordCountField"]');
textField.addEventListener("input", function() {
const count = textField.value.trim().split(/\s+/).filter(Boolean).length;
wordCountField.value = count;
});
});
</script>
Once the word count is stored in a hidden field, you can use it in your pricing conditions.
Let us know how it turns out.
-
editorialnevadadailymailReplied on October 2, 2025 at 3:07 PM
Awesome! I'll try it out.
Thanks!
Your Reply
Something Went Wrong
An error occurred while generating the AI response. Please try again!