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

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
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,510 views 4 13
Read article

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