I have a function showMap which opens a new window(window.open).In the new window I have a iframe googlemaps and a input with button.How can i pass the data when user clicks the button to a function in the parent window?
var popUpWindow ;
function showMap(){
popUpWindow = window.open(index)
popUpWindow.document.write( '<html><head><title>MAP</title>
</head><body>
<iframe src="https://maps.google.com/maps/embed/v1/directions?>
</iframe> <br> <input type="text" id="data>
<button type="button" onclick="opener.callParent()">
Update</button></body></html');
}
function callParent(){
var newValue = popUpWindow.document.getElementById('data').value;
console.log('newVal',newValue);
}
Doing in this way i was able to get the value from child window to parent window.