I was looking at how to create a namespace in Jquery and create a kind of a class that one would create in C#, I read through this article and came up with this in a seperate JS file
var GlobalScript = {
myStuff: function(){
alert("hi");
}
}
and I have tried calling the function like this in another external file..
$("#btnSave").click(function(){
GlobalScript.myStuff();
});
and when it gets called I am getting an error in saying that it undefined, what am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire