Is it as simple to do a letter count?
-----Original Message----- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Liam Potter Sent: Friday, July 24, 2009 6:53 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: How to deterine number of words in a string? or if you really do want it as a plugin Plugin: (function($){ $.fn.stringCount = function() { var string = this.text(); var count = string.split(" "); var result = count.length; return result } })(jQuery); Use: $(function(){ alert( $("span.string").stringCount() ); }); Liam Potter wrote: > you don't need a plugin, this will do it > > var string = $("span.string").text(); > var count = string.split(" "); > alert(count.length); > > > Conrad Cheng wrote: >> Hi all, >> Any jquery plugin can check number of word in a string instead using >> of .length?... >> >> Many thanks. >> >> Conrad