I've set up my form with the code from this thread: Counting and limiting words in a textarea
However the fiddle code was written with jQuery 1.8.3 and it is working fine with that however, my wordpress site is using jquery 1.11.0 - what sort of modification do I need to make to the code for it to work with this version of jquery? Code below...
Thanks for your help.
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.3.js'></script>
<script type='text/javascript'>//<![CDATA[
$(function(){
$(document).ready(function() {
$("#word_count").on('keydown', function(e) {
var words = $.trim(this.value).length ? this.value.match(/\S+/g).length : 0;
if (words <= 200) {
$('#display_count').text(words);
$('#word_left').text(200-words)
}else{
if (e.which !== 8) e.preventDefault();
}
});
});
});//]]>
</script>
<textarea name="txtScript" id="word_count" cols="30" rows="10"></textarea>
Total word Count : <span id="display_count">0</span> words. Words left : <span id="word_left">200</span>