remove html comments from string
What is the best way to get rid of html comments in a string? I need to check if there is anything in a div which is not a comment (it can be text, image or text and image).
I extract the content of div with innerHTML() function but it returns also all the comments. I get something like this
<--this is comment1-->this is my text.<--this is comment2-->
instead of
this is my text.
I could loop through a string and find substrings which contain "--" and then remove everything between them but I am wondering if there is a better way of doing it.