1651
Views
1
Comments
Is this possible to override Javascript functions?
Question

Hello,

Suppose if I am using a webblock from another eSpace and it used 2 JavaScript functions. Is it possible for me to overrride those Javascript functions in my current eSpace so that that webblock will start referring the new JavaScript functions?

Thanks and Regards,

Suraj Borade

2020-03-05 14-29-02
José Costa

Hi Suraj,

Yes, it's possible.

Just do this:

yourfunction = function(<parameters>) {
     alert("I'm the new function");
}

If you still want to call the original function do this:

var origfunction = yourfunction;
yourfunction = function(<parameters>) {
     alert("I'm the new function");
     return origfunction(<parameters>);
}

It should work.

Cheers,

José

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.