Overriding a function defined when jquery closes

I have a function defined in a jquery closure and called by another function in the same closure. Can I override the called function without changing the closure itself. See code for example

(function($){
    function Myfunction(value)
    {
        //do something with the value
    }
    $('a').live('click',function(){
        MyFunction($(this).val())
    });
}(JQuery));

There is a way I can override Myfunctionso that the redundant copy Myfuntionis called inside the event handler.

+3
source share
2 answers

You can not. Functions defined inside closures are private - and they:

[impossible] to access directly from outside an anonymous function

+2
source

function f() {} ( , ). var f = function() { } f .

0

All Articles