I have a form that is opening a new window on submit:
<form id="form-id" target="_blank">
I want to access the newly created window via javascript, without manually generating a unique name for target, and without resorting to an alternative method for opening the window.
It seems like there has to be an easy way of doing this but I wasn't able to find one that will work in my specific situation.
Instead of _blank
then you can use name your new window.
<form id="form-id" target="newName">
Then you can use it in JS by doing:
var newWindow = window.open(null, 'newName');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With