My idea was to create a button to hide/show all hidden text (Hide by highlighting the text in black, show by making the background color of the text transparent). But the codes,
Use a class instead of an id. Then use document.getElementsByClassName("p2") which will return an array of the matching elements and loop over them.
class
id
document.getElementsByClassName("p2")