我刚接触JavaScript和jQuery,我发现了一个this插件,它可以让我计算文本框中的字数。我能够在我的表单中实现这一点。然而,我想要做的是,如果用户添加超过25个单词,它将给我一个错误。
我在表单中使用jquery validation进行验证。
我的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)
})});
当我在我的页面上查看此内容时,我看到了以下内容;

我的问题是如何访问Object > words?
提前感谢
发布于 2015-07-24 14:59:37
Countable.live($('#textarea'), function (counter) {
var totalWOrdsCount = counter.words;
})https://stackoverflow.com/questions/31603575
复制相似问题