Reputation: 53
Is there a way to reference a popup window in Javascript or JQuery that identifies each window with a unique name? I declare one variable to create the window but in the event of multiple popup windows, I was wondering if the 'name' attribute could somehow be attached to a Jquery selector to target a specific window?
var popup = open('message.html',"'" + name + "'", 'height=300,width=300,location=no,resizable=yes,scrollbars=yes');
Upvotes: 2
Views: 51
Reputation: 816810
You can use an object as map:
var popups = {};
// ...
popups[name] = open('message.html', name, ...);
// ...
popups[name].close();
Upvotes: 5