With regular expressions, it's simpler than all this .. you can count
letter groups that are split up by anything that's not a letter or a
digit.

var string = $("span.string").text();
var mresult = string.match(/\w+/g);
alert(mresult.length);





On Jul 24, 8:41 pm, Lukas Lt <1luk...@gmail.com> wrote:
> Well you can replace '!, into spaces and then count
>
> Also I'd do a loop and remove empty elements (if multiple paces was in
> text) before counting.
>
> On 24 Lie, 13:25, Raju <raju3...@gmail.com> wrote:
>
> > Hi
>
> > i want a jquery plugin to view word files,
>
> > can somebody help me out in this regards
>
> > Warm Regards,
>
> > Mari Raj K,
> > Bangalore
> > +91 9916140688
>
> > On Fri, Jul 24, 2009 at 3:49 PM, Liam Potter <radioactiv...@gmail.com>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

Reply via email to