Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get all visible text on website javascript

 function isHidden(el) {
     var style = window.getComputedStyle(el);
     return ((style.display === 'none') || (style.visibility === 'hidden'))
 }

 // get the body tag
 var body = document.querySelector('body');

 // get all tags inside body
 var allTags = body.getElementsByTagName('*');


 //console.log(allTags);


 for (var i = 0, max = allTags.length; i < max; i++) {
     if (isHidden(allTags[i])){
         // hidden
     }
     else { 
         console.log(allTags[i].innerText);
     }
 }
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript count occurrences of word in string 
Javascript :: firestore save a score as a number not a string in js 
Javascript :: react native on expo finger print is working bt not in apk 
Javascript :: input type disappear side scroll react 
Javascript :: how to get selected value from between form tags in Angular 
Javascript :: window reload in only 767 screen 
Javascript :: server sent events node js + github 
Javascript :: Expressions 
Javascript :: what is mdoe in math 
Javascript :: play store version of react native app 
Javascript :: react prototype function 
Javascript :: adding preview images to react apps for linkedin 
Javascript :: eosio name to int js 
Javascript :: pase de fotos automatico javascript 
Javascript :: { "data": [ { "title": "", "img": "", "address": "" }, ] } json to html 
Javascript :: mount Node.innerHTML 
Javascript :: datatables pass headers on request 
Javascript :: webpack css not shoud be empty 
Javascript :: karma error parent child 
Javascript :: parallel testing vs cross browser testing 
Javascript :: do nonmetals lose electrons 
Javascript :: css rotate3d euler angles 
Javascript :: code in nested forEach loop- react native 
Javascript :: how to wait for an exec command to fininsh in nodejs 
Javascript :: benchmark ram usage angular 
Javascript :: how to compare a string with its ending in javascript 
Javascript :: event handler attachment jquery 
Javascript :: javascript es6 quizes 
Javascript :: selenium how to automate javascript dialogs 
Javascript :: json identifier with period 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =