Character Counter for Multiple Open-End Questions

Hi,

I have a page with FOUR Open-End questions on it. I usually use the following codes in the header and footer to create a character counter but have found that only the character counter in the FIRST question actually works regardless of which text box I type in. (If I type in the text box of the 4th question, the character counter in the first question counts down.)

Is there a way to have each counter work for each question?

This is the code I have in the header/question and footer:

HEADER:

<form>

<label for="textareaChars">(3,000 character limit, 450-500 words)</label>

<font color=red> (<span id="chars">3,000</span> characters remaining)</font>

</form>

FOOTER:

<span class="[% QuestionName() %]_wordcount"></span>

<script>

var maxLength = 3000;

$('textarea').keyup(function() {

var length = $(this).val().length;

var length = maxLength-length;

$('#chars').text(length);

});

</script>

Thank you so much!

1 reply