javascript - call function inside $ (function () {...}) jquery -
call function inside $ (function () {...})
example:
$ (function () { makealert function (text) { alert (text) } });
i want call "makealert" function block.
makealert call ()
not work.
please help!
you can't. you've scoped function function declared within.
move outside global. there no need delay definition until ready event fires.
alternatively, create global reference within outer function.
window.makealert = makealert;
it wouldn't recommend unless have other reason keep function being declared until ready event fires more complicated.
Comments
Post a Comment