Jquery word counter without maximum number
Could you suggest any word counter in jquery which doesn't have maxcount
option ?
I have looked for many plugins but all of them limits the maximum word number.
I would like to have a function which takes two parameters, textarea_i开发者_运维问答d
and span_id_of_#ofwords
and just simply show the numbers of the words in textarea.I may modify the plugins but I rather not to do.
Thanks.
Take look at this question. With that you can do:
function countWords(textarea_id, span_id)
{
$("#"+span_id).text($("#"+textarea_id).val().match(/\S+/g).length)
}
hmmm, why can't you just count it yourself? it'd be something like:
$(#span_id_of_NoOfwords).html($(#textarea_id).text().split(' ').length))?
精彩评论