I am trying to change the content of the div which is a part of the parent page using the child page. In order to update the content, I use innerHTML. The contents appear just fine but the onclick event on the images does not work. Here is my code, the code works in Mozilla firefox but does not work in Chrome and Safari. Also, it does not work on iPad safari browser.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>TEMP</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script src="scripts/jquery-1.8.2.min.js"></script>
<script>
$(document).ready(function() {
//this is the parent element
parent.document.getElementById('hd').innerHTML = document.getElementById('temp').innerHTML;
});
</script>
</head>
<body>
<div id="fakeshare" style="float: left;margin-top: -30px;z-index:1000000;position: absolute;vertical-align: middle">
</div>
<!-- this is the content I try to populate in the parent element -->
<div id = "temp" style="visibility: hidden">
<div style="float:left">
<img id="backbtn2" class="imgtopbutton" src="images/facebook-cancel.png" onclick="javascript:history.go(-1)" align="left" style="margin-left:12px;margin-top:10px"/>
<img class="imgtopbutton" src="images/facebook-post.png" align="right" style="margin-top:-31px;margin-left:545px" onclick="javascript:history.go(-1)">
</div>
</div>
</body>
</html>
id="hd"?iframe?