I have 3 html pages. main.html, page1.html and page2.html. I am displaying page1.html and page2.html in main.html using following code.
<html>
<frameset frameborder="1" rows="50%, *">
<frame src="page1.html" />
<frame src="page2.html"/>
</frameset>
</html>
page1.html code
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="myjs.js"></script>
</head>
<body>
<table id="resultDetails">
<th>Result Details</th>
<tr>
<td>Row 1</td>
<div id="r1">
<p> R1 data</p>
</div>
</tr>
</table>
</body>
</html>
And Page2.html code
<html>
<body>
<div id="myDiv">
<p> Testing.... </p>
</div>
</body>
</html>
My JavaScript myjs.js
$(document).ready(function () {
$('table tr').on('click', function () {
$('#r1').load('page2.html#myDiv');
});
});
With this code, on click on table row, i am able to display the "myDiv" content in "r1". But I want reverse behavior. i.e., on clicking row, content of div "r1" of page1 should be displayed in div "myDiv" of page2. I tried $('page2.html#myDiv').html('#r1'); but no success. Any thoughts