0

I want to collect only the text that is actually visible onscreen using JavaScript, excluding all the html tags, JavaScript, CSS code, hidden text and other stuff that is in the source, just the visible result of all that as it appears in real-time on the browser screen. Basically I want to simulate pressing Ctrl+A with JavaScript. Can this be done?

Matthew
  • 11
  • 2
  • 1
    Check this answer: https://stackoverflow.com/questions/21311299/nodevalue-vs-innerhtml-and-textcontent-how-to-choose Using document.body.innerText might be what you want - that would grab all text content on the page that is currently visible. – Clark Apr 12 '21 at 17:41
  • Use `document.body.innerText` instead – Rojo Apr 12 '21 at 17:42
  • Try this if the previous answer didn't work! https://stackoverflow.com/questions/44028502/mimic-ctrla-with-javascript – Santosh Apr 12 '21 at 17:48

0 Answers0