qodeninja
qodeninja

Reputation: 11266

Using jQuery, how can you trigger an event from a child window, in the parent window?

Basically I want to call a function in the parent window. I thought I could hook an event handler to a function I want to run in the parent... any thoughts how to do this?

Upvotes: 1

Views: 1435

Answers (2)

qodeninja
qodeninja

Reputation: 11266

window.opener.parent.function() does the trick, but in my case I needed to keep a copy of window because the context changed when I used setTimeout.

    var _window = window;
    setTimeout( function(){             
        //location.reload(true);
        _window.opener.invite_child_response();
        _window.close();                    
    },5000);

Upvotes: 0

Daniel Protopopov
Daniel Protopopov

Reputation: 7236

From child window, use

parent.MyFunction()

Upvotes: 2

Related Questions