Toggle Visibility



I am setting the visibility of a object using the following:

hypeDocument.getElementById(mydoc).style.visibility = "hidden";

Currently I then use a button to set the visibility:

hypeDocument.getElementById(mydoc).style.visibility = "visible";

When the button is now clicked I would like to toggle the visibility, is this possible?

I have tried the JQuery toggle but have been unable to get this working.



You could do a regular If then statement, and run it when clicking something:

   if ( hypeDocument.getElementById('mysquare').style.visibility == 'hidden') {
		hypeDocument.getElementById('mysquare').style.visibility = "visible";
	} else {
		hypeDocument.getElementById('mysquare').style.visibility = "hidden";
	} (31.5 KB)


Many thanks Daniel that would work great!