Strip html tags, css and js code from string
-
28-09-2019 - |
Pergunta
I am using document.documentElement.textContent.toLowerCase()
to read a website text content, the problem is this website has so many css and js code before any real text that I don't even get the complete text, it gets trunked in some part of the css.
How can I remove all the css and js code to retrieve only the text content?
Solução
What about this?
var text = document.getElementsByTagName('body')[0].textContent.toLowerCase();
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow