I have a popup window and I want to run a function from in the parent window.
In the child I have:
$(document).ready(function(){
parent.$.fn.guestFromPop('Action');
});
In the parent I have:
$(document).ready(function(){
function guestFromPop(data) {
alert(data);
}
});
The problem is when parent.$.fn.guestFromPop('Action'); I never see the alert, nothing happens. Am I doing something wrong?
This doesn’t declare the function
$.fn.guestFromPop:…all it does is declare
guestFromPop(), a function only available inside thatdocument.readyhandler. You would need to declare the function you’re after instead:Though, this isn’t really correct either, since it wont be called on a jQuery element, you may want something as simple as :
called by: