Got it. I need to define as

(function() {
        msg = function() {
                alert("Hello User");
        }

})();

Thats it.

On Feb 19, 11:08 am, JQueryProgrammer <jain.ashis...@gmail.com> wrote:
> How can we define functions even before the DOM loads fully. I tried
> like
>
> (function() {
>         msg = function() {
>                 alert("Hello User");
>         }
>
> });
>
> $(function() {
>         msg();
>
> });
>
> This is just an example. But it gives me "Object Expected" error.
> Please let me know how to do it.

Reply via email to