How to refresh the parent window and close the child window on clicking the button in child window using JavaScript
If you want to close your child window and refresh its parent window on click of a button, we can do that with the help of following code:
HTML:
<button type="button" onclick="closeWindow()">Click Me</button>
JS:
function closeWindow(){
opener.location.reload();
window.close();
}
In this, opener.location.reload will help you reload you parent window.
And window.close is used to close the current window i.e. the child window.
Hope this will help you.
0 Comment(s)