I want my parent window to have button that opens child window. Child window should have an input text box and a button(Named Copy). Whatever i enter text in child window textbox and click Copy button, the child window should close and entered name should appear on parent window.
I am trying below approach but can't understand how to retrieve enter value on parent.
p>Click the button to create a window and then display the entered name on parent window.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var myWindow = window.open("", "MsgWindow", "width=200,height=200");
myWindow.document.write("<p>This window's name is: " + myWindow.name + "</p>");
myWindow.document.write("<br/>");
myWindow.document.write("<input type='text' id='txtId' />");
myWindow.document.write("<input type='button' value='Copy'/>");
var x = localStorage.getItem(Name);
}
myWindow.opener.document.write("Landed to prent");
}