Chris
Chris

Reputation: 483

jQuery Sequential Functions

I'm looking to run multiple jQuery functions one after another. There are several threads about this but they only ever seem to show how two functions are done. My second function doesn't seem to execute. Where have I slipped up? http://jsfiddle.net/BSYDv/

$(document).ready( 
    function(){  
        $(function() { alert("1")}, 
          function() { alert("2")}, 
          function() { alert("3")}
         );                     
    });

Upvotes: 1

Views: 1741

Answers (1)

A. Wolff
A. Wolff

Reputation: 74420

You could write it like this using auto-called anonymous functions:

http://jsfiddle.net/BSYDv/2/

$(document).ready( 
    function(){ 
          (function() { alert("1")})(), 
          (function() { alert("2")})(), 
          (function() { alert("3")})();                     
});

Upvotes: 3

Related Questions