hi,
I've got 2 jQuery functions. One calls the other (in theory...). These are:
$.testFunction = function(arg1){
alert("testFunction(arg1)");
$.testFunction(arg1, "");
}
$.testFunction = function(arg1, arg2){
alert("testFunction(arg1, arg2)");
alert("arg1: " + arg1 + "\narg2: " + arg2);
}
I've got two functions, because when I haven't got the second parameter to pass, I'd like to call the simple version of them. But when I call like this:
$.testFunction("first param");
alert("Before second call");
$.testFunction("first param", "second param");
It's always calling the second one, and (in the alert window) puts: "testFunction(arg1, arg2)" then "arg1: first param arg2: undefined". Why is working like this? Why is not the first function being called when I pass only one parameter?