This script will add a visual element to the instruction area of a question.
If you paste this into the instruction field in designer.
<span class=”countdown”></span>
<script>
function updateCountdown() {
var remaining = 500 – $(‘textarea’).val().length;
if (remaining <= 0) {
var enteredText = $(‘textarea’).val().substr(0,500);
$(‘textarea’).val(enteredText);
$(‘.countdown’).addClass(‘errorquestion’);
} else {
$(‘.countdown’).removeClass(‘errorquestion’);
}
$(‘.countdown’).text(remaining + ‘ characters remaining.’);
}
$(document).ready(function() {
updateCountdown();
$(‘textarea’)
.change(updateCountdown)
.keyup(updateCountdown);
});
</script>
The numbers in bold is what you would change, don’t forget to set a field width as well.
Preview –