- Posts: 3
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var thisQuestion = $('#question{QID}'); var thisTextArea = $('textarea:eq(0)', thisQuestion); // Set minimum characters var minCharacters = 10; function handleCharacterCount() { var thisVal = $.trim($(thisTextArea).val()); var thisCount = thisVal.length; $('.character-count', thisQuestion).text(thisCount); if(thisCount <= minCharacters) { $('#ls-button-submit').prop('disabled', true); } else { $('#ls-button-submit').prop('disabled', false); } } // Initial state handleCharacterCount(); // Listener on the textarea $(thisTextArea).on('keyup change', function(e) { handleCharacterCount(); }); }); </script>