I have added legends to many of my plots, and now I want some of them to be initially hidden when I open the HTML file. I would like to show them by clicking on the corresponding legend when I want to see them.
Do you mean legend items? The legend is the entire thing, a collection of individual legend items. It’s not clear what you are asking to do. Annotated screenshots would probably help immensely to clarify and remove ambiguity.