Why is my javascript rendering correctly in preview mode but stops working once the page is saved?

My code is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<title>IMG EXPAND</title>

<style type="text/css">
#ToggleTarget {
	display: none;

<script type="text/javascript">
function Toggle() {
	var el = document.getElementById("ToggleTarget");
	if (el.style.display == "block") {
		el.style.display = "none";
	else {
		el.style.display = "block";


<p><a href="javascript:Toggle();"><img src="https://thegrid.solarcity.com/download/attachments/37202190/warehouse.jpg?version=5&modificationDate=1447954817206&api=v2"/></a></p>

<div id="ToggleTarget">OMG YES<br />I DID IT I IS SO SMART</div>


1 answer

This widget could not be displayed.

How does it look like? What does the browser logs say? Any errors?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 17, 2018 in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

568 views 7 6
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you