domladden
10 years agoAce
Word Count component
Hi, I need to create a quick little component that will pull the word count from my articles.
I've checked the community here and can't find much more than a suggestion for a product idea that wasn't picked up.
I can pull the body of my articles with a simple API call: /restapi/vc/messages/id/3701/body
This will dismiss all the content in other parts of the page (related content, labels etc.) but it returns a bunch of HTML, is there any quick of stripping out everything that isn't contained in a <span> tag, counting that and storing it in a variable?
Hopefully I want to end with nothing but a number at the bottom of my articles, doens't sound too hard but I'm struggling so far.
Thanks,
Dom