Figure this out:
Page A contains this in body :
<div class="overlay-homepage"><span></span></div>
Page B contains:
<div class="overlay-results"><span></span></div>
I can use this script to determine if they contain an overlay class with this:
function() { var htmlString = $('body').html().toString(); var index = htmlString.indexOf("div class=\"overlay-"); if (index != -1) return("It works"); }
For the return value instead of βIt works,β how do I get it to pull the rest of the class name, for example. "overlay-results" or, if required, all div content, for example. " <div class="overlay-results"><span></span></div> "?
There are many other similar pages with different names "overlay-", so I do not want to do one search for each of them, so this approach is "one size fits all."
javascript jquery css
aphextwig
source share