Reveal Hidden element onclick while hiding other elements

Hmm,
If I understand right.
I would think all you need to do is give each element group a class name.
Then just use the simple trick of hiding them all at the beginning of the showElement2() function

function showElement2(val){
		//var hypeDocument = getHypeDocument();
		var blockEl_ = document.querySelectorAll('.blockEl')
		for (let i = 0; i < blockEl_.length; i++) { 
  				
  					hypeDocument.getElementById(blockEl_[i].id).style.display='none';
			}
		
		console.log(val);
		var target = (val);
		// alert(target);
		hypeDocument.getElementById(target).style.display='block';
		};

ShowOnClick.hype.zip (55.9 KB)

1 Like