Is there a way to get a reference to all the paragraphs or headings in a web page in JavaScript?
- by mattbd
I'm writing a simple Greasemonkey script to strip out all the images, headings and paragraphs from a web page (it's because someone wants to use images of several popular websites with the images and text removed in a presentation about branding of websites). I've figured out how to do so with images by using a for loop and the document.images array like this:
var i = 0;
var imglngth = document.images.length;
for(i=0;i<imglngth;i++)
{
document.images[i].style.display="none";
}
However, I don't believe there's an object representing paragraphs or headers. Any suggestions as to how I could implement this?