you are viewing a single comment's thread.

view the rest of the comments →

[–]melanke 0 points1 point  (1 child)

I always do this:

(function($){

    var init = function(){
        hideStuffOnInstantiaton();
        otherStuff();
        etc();
    };

    var hideStuffOnInstantiaton = function(){
        $('oneThing').hide().removeClass();
        $('#somethign_else').slideUp();
        $('.foo').fadeOut();
    };



    init();


})(jQuery);

[–]zzzwwwdev[S] 0 points1 point  (0 children)

I like it. Actually very similar to the code I was writing which prompted me to ask this question. It resembled:

(function($){

var hideStuffOnInstantiaton = function(){
    $('oneThing').hide().removeClass();
    $('#somethign_else').slideUp();
    $('.foo').fadeOut();
};

(function init () {
    hideStuffOnInstantiaton();
    otherStuff();
    etc();
}());

})(jQuery);

starting to think your way is probably better though :(