Calling a grandparent JS function that includes jquery from a nested iFrame. D7
Introducing a closure around the whole function (as in your 2nd and 3rd examples) will take it out of the global scope, so it won't be available on the window, and subsequently the iframe's parent (which are the same thing).

What you're looking for is more like:

function grandparent_func() {        
  (function($) {
    $("#fancy_regit_link").attr("href", "/my/actual/path");
    $("#fancy_regit_link").trigger('click');                
  })(jQuery);
}


That makes sure grandparent_func is global, while still providing you the jQuery object.