I feel that I might be overlooking something here. I wan to display the character count of a textarea in a <span> element underneath the <textarea>. I am using the following jQuery and HTML:
jQuery:
$('#ws3 .textarea textarea[name="company-description"]').keyUp(function() {
var charLength = $(this).val().length;
$('span#charCount').html(charLength + ' of 250 characters used');
if($(this).val().length > 250)
$('span#charCount').html('<strong>You may only have up to 250 characters.</strong>');
});
HTML:
<div id="ws3" class="ws-section">
<label for="company-description">Describe your company for us</label>
<div class="textarea">
<textarea id="company-description" name="company-description" class="ws-required"></textarea>
</div>
<span id="charCount">charCount</span>
</div>
Also, all jQuery code following this block does not work, almost as if the browser has stopped reading the .js file at this block of code.
There is no
keyUpfunction.. change it tokeyupand then it should work fine..DEMO
Tips:
jsfile or next<script>blockkeyUp