[英]Countable.js get in Object
I'm new to JavaScript and jQuery, I found this plugin which allows me to count the amount of words in a textbox. 我是JavaScript和jQuery的新手,我发现了这个插件,可以让我计算文本框中的单词数量。 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.
但是,我想做的是,如果用户添加的单词超过25个,则会给我一个错误。
I am using jquery validation in my form to validate. 我在表单中使用jquery验证进行验证。
The code I have in my Javascript is; 我的Javascript中的代码是;
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;
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.