Defining Custom methods for Pre-defined (inbuilt) Java Script methods
HOW to Define Custom methods for Pre-defined (inbuilt) Java Script methods
Some times i face the situation where i would need to override the existing inbuilt Java Script methods...Defining custom method is pretty easy, i have given below an example to override the existing Alert method...
//Overriding Javascript Alert method
var alertClone=window.alert;
if(document.getElementById)
{
window.alert = function(sMessage) { customAlert(sMessage);}
}
function customAlert(sMessage)
{
alertClone(sMessage);
}
just copy paste the code in your JavaScript and add your code inside CustomAlert() method...
Posted by
Ranjith