Hi
I am just wondering what is the difference between these two
File1.js
$(function()
{
function MyFunction()
{
// some code here
}
});
File2.js
$(function()
{
// call it.
MyFunction();
});
File1.js
function MyFunction()
{
// some code here
}
File2.js
$(function()
{
// call it.
MyFunction();
});
So what is the difference? When I did the first way and I tried to call MyFunction() from File2.js it never worked. I moved my function out of the Jquery.Document ready in File1.Js and it worked.
I have some other functions that are in File1 and even though they are in document ready anything in File1 can seem to call it no problem.
It just seems like across script files it has a problem calling functions when setup that way.