One approach you can take is to loop through each node, and count the words if it's a text node, or loop through the child nodes if it's not.
This requires a few extra details, for example some elements you want to skip (<script> tags, for example), some you want the "value" instead, etc. But...
For some date strings (e.g. "Aug 1, 2010") you can use Date.parse() to turn them into a numeric value. However for short dates it expects the american format of MM/DD/YYYY.
So if you've got days first, one way to do what you want is to take the date strings, split them up into numbers, then do...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.