I wanted to count number of characters in a string which I pull from div tag like this:
$(".welcome-msg").html().length;
However it’s counting HTML comments as characters inside the tag. So when I would like the result to be 0 I get 99 because of those comments and I don’t have a way of telling if comments are dynamic or not. Is there an easy way to make sure comments are not counted? Or do I have to write regular expression for that?
Thanks,
regex from here StackOverflow: Remove HTML comments with Regex, in Javascript