I am trying to show/ hide set of web parts on click. I already wrote the coding and I can hide/show web parts one by one on click and the reason is that each web part has unique Id. Now I am facing with problem because I cannot hide 6 web part together on click and show 6 others. I tried to add different to a wiki page in SharePoint. so I can add 6 web part to each of them and then I have one id for each set, but it didn't work! If someone can help me how to reach "one" ID for set of web parts in SharePoint I would appreciate.
This is my JavaScript coding for each web part and it works well but too long!:
function showhideReport(){
var div =document.getElementById('WebPartWPQ9')
div.style.display=(div.style.display=="none") ? "block" : "none";
if(document.getElementById('WebPartWPQ3').style.display=="block")
document.getElementById('WebPartWPQ3').style.display="none";
if(document.getElementById('WebPartWPQ10').style.display=="block")
document.getElementById('WebPartWPQ10').style.display="none";
if(document.getElementById('WebPartWPQ4').style.display=="block")
document.getElementById('WebPartWPQ4').style.display="none";
if(document.getElementById('WebPartWPQ5').style.display=="block")
document.getElementById('WebPartWPQ5').style.display="none";
if(document.getElementById('WebPartWPQ13').style.display=="block")
document.getElementById('WebPartWPQ13').style.display="none";
}
Thank you