I have a table data in a form and there is dynamic link in each row which opens an external link in a new window (new browser tab). These rows are in n numbers with dynamic id.
What I need here is,when user try to submit the table details, they must close all the child windows. If any child div is still opened and if he tries to submit the form, it should given alert to close the child windows
Here is the sample DEMO of the form
<form>
<table border="1">
<tr>
<td><input type="text" /></td>
<td>SC1</td>
<td><a href="http://www.google.com" target="_blank">this is an external link</a></td>
<tr>
<td><input type="text" /></td>
<td>SC2</td>
<td><a href="http://www.google.com" target="_blank">this is an external link</a></td>
<tr>
<td><input type="text" /></td>
<td>SC3</td>
<td><a href="http://www.google.com" target="_blank">this is an external link</a></td>
</tr>
</table>
<input type="submit" value="submit" />
</form>
You can store each opened window in an array and perform a check for open windows when the user tries to submit the form:
Demo fiddle