I am using window.opener to pass a string value from a child window to a parent window as so-
function reply_click(clicked_id)
{
alert(clicked_id);
window.opener.document.write(clicked_id);
window.close ();
}
Where the cliced_id is the string I am passing back.
However I want to pass this back to a hidden input on the main page so I can use it again. The problem being is that I cannot specify where to put the string value on the main page and instead it just loads the string value in a new page without any of the original content.
Is it possible to pass back the string and keep the original HTML content?
Yes, if you have a an element on the original page with an id , you can reference that using
getElementByIdand set theinnerHTML:eg, with an empty div on the page:
You could use this code