Javascript: how to check if a text exists in a web page -


let's string "done successfuly" displayed somewhere in webpage , there way know if string exist using javascript ? thanks.

more details help. there may better ways. best given information you've provided:

if (   (     document.documentelement.textcontent || document.documentelement.innertext   ).indexof('done successfuly') > -1 ) {   // something... } 

if know id or class-name or can otherwise select element directly contains text (e.g. h1#someheading span ...) should more performant , cleaner approach.

edit worth noting: approach pick text within script , style tags too, not want. both textcontent , innertext have various quirks across browsers too. see more info.


Comments

Popular posts from this blog

Pull out data related to my apps from Android Play Store and iOS App Store -

Change php variable from jquery value using ajax (same page) -

How can I fetch data from a web server in an android application? -