I'm new to JavaScript and jQuery, I found this plugin which allows me to count the amount of words in a textbox. I was able to implement this into my form. However, what I would like to do is if the user adds more than 25 words it will give me an error.
I am using jquery validation in my form to validate.
The code I have in my Javascript is;
jQuery(document).ready(function($){
$('#textarea').simplyCountable({
counter: '#words',
countType: 'words',
maxCount: 25,
overClass: 'over',
countDirection: 'up'
});
var area = document.getElementById('textarea')
Countable.live(area, function (counter) {
console.log(counter)
})
});
When I view this on my page, I see the following;
My question is how can I get to Object > words?
Thanks in advance
Countable.live($('#textarea'), function (counter) {
var totalWOrdsCount = counter.words;
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.