I have a parent page that contains a textarea and a link to open a child window. The child window has another textarea and a button. User enters some text in the textarea in the child window and clicks the button, a javascript gets fired that updates the content of the textarea in the parent window with that of the textarea of the child window and closed the child window.
I am currently doing this in javascript and it works fine, but since we will move to jQuery very soon how would one accomplish the same using jQuery.
page1.html
----------
<script type="text/javascript">
function newwin() {
window.open('page2.html','','width=600');
}
</script>
<body>
<textarea id='t1'>
<a href="javascript:void(0)" onclick="newwin();">Click here</a>
</body>
page2.html
----------
<script type="text/javascript">
function updateparent() {
window.opener.document.getElementById('t1').value = document.getElementById('t2').value;
window.close();
}
</script>
<body>
<textarea id='t2'>
<input type="submit" onclick="updateparent();">
</body>