In short i want to overwrite a javascript function with a newer one, but in that newer function i want to be able to call the old one. So for example:
function test()
{
alert('original');
}
// then some time later
function test()
{
alert('new function');
}
// call function
test();
In this case only the last test()
is invoked. So the new function
is alerted.
But is there a way to call the first test()
method aswell? SO both test()
function get invoked?
The reason i need this is because a web application generates an onSave()
method. This function is triggered when a form is saved through Ajax.
I want to do some additional things when the form is saved but i can't just change the original onSave()
function. That is why i'm looking for a way to extend it.
How can i do this?