I have a page where i need to count the chars in a user input dynamically. As of right now i just parse .value.lenght to a field, but i need to parse the exact chars, not including spacees and newlines.

Any ideas of how to do this?

My first idea was to use indexOf(" ") to find the first occurente of a space and then loop indexOf(" ", previousOccurence) until it equalled lastIndexOf(" "); But either it dosn't work or i screwed up in the syntax

Any ideas are welcome

// Martin