Hey,
I am trying to set the word limit for a text area. I am nearly there, but can't quite get it to work. I can get it to count down the words, but the maxlength field is still counting the words so if there is a limit of 200 words it stops allowing input at 200 characters. The message on the screen has the word count correct.
Could someone help me finish off this code so it works. I have stripped it out of my page so you can see it easily. You can test this code and it will work in a browser:
Thanks in advance
Cheers
Rob
I am trying to set the word limit for a text area. I am nearly there, but can't quite get it to work. I can get it to count down the words, but the maxlength field is still counting the words so if there is a limit of 200 words it stops allowing input at 200 characters. The message on the screen has the word count correct.
Could someone help me finish off this code so it works. I have stripped it out of my page so you can see it easily. You can test this code and it will work in a browser:
Code:
<script type="text/javascript" src="jquery/jquery.js"></script>
<link type="text/css" href="jquery/smoothness/jquery-ui-1.8.1.custom.css" rel="stylesheet" />
<script type="text/javascript" src="jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery/jquery-ui-1.8.1.custom.min.js"></script>
<script src="jquery/jquery.maxlength.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("#accordion").accordion({autoHeight: false });
});
$(function() {
$("#tabs").tabs();
});
$(function(){
$('textarea.wordLimited').maxlength({
'words': true,
'feedback': '.wordsLeft'
});
});
//-->
</script>
<form>
<strong>Profile: </strong>(200 words maximum)<p> <strong>Words left:</strong> <span class="wordsLeft">200</span></p>
<textarea maxlength="200" class="wordLimited" name="recom" style="border:1px solid #666666; width:655px; height:90px; margin:0px 0px 10px 0px; overflow:auto;"></textarea></form>
Thanks in advance
Cheers
Rob