This does work, unless you set the visibility of ‘mysquare’ to hidden. The JS looks like it should turn the visibility on, but it doesn’t. How would you start with the square initially not visible?
I’ve never been a fan of the terminology used in the “Visibility” section - I think it is misleading. The “Display” name is fine as it is setting the “Display” property. But “Visible” & “Hidden” are not the terms to use with “Display”… which in this case “none” & “block” would be more appropriate.
Please visit these two links to read about the “Visibility” & “Display” properties.