In my application I need to call a function in the parent window after closing the child window.
The calling is done successfully but in that function I also post a value from a text box in the parent window.
When I post the value from the text box it alerts ‘undefined’.
This is the function for the child window after closing the child window:
function CallParentWindowFunction()
{
window.opener.ParentWindowFunction();
return false;
}
This is the function in the parent window:
function ParentWindowFunction()
{
var hidadinfoid = $("#hidadinfoid").val();
alert(hidadinfoid);
}
This alerts ‘undefined’.
This is the html input box in parent window:
<input type="hidden" name="hidadinfoid" value="12" />
Where is the mistake in my code?
hidadinfoidis the value ofnameattribute of input, not itsid, try this:or add an
idattribute to the input: