-4

i get a Unexpected token { error on this line

var isSplash =true;
//------DocReady-------------
--->    $(document).ready{(function()};
 if(location.hash.length == 0)
    location.hash="!/"+$('#content > ul > li').eq(2).attr('id');
user1612508
  • 25
  • 1
  • 6
  • 3
    How is this different from the examples you saw? (tip: it's the `{`) Honestly, you got a *beautiful* error message, and the exact location. – Kobi Aug 20 '12 at 19:51
  • Try this: [document.ready shortcuts](http://stackoverflow.com/q/3907527/475820). – TLS Aug 20 '12 at 19:51
  • 1
    This is just not how you call functions. Please review https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Functions – Felix Kling Aug 20 '12 at 19:53

2 Answers2

4

You don't need to pass an object to the ready (or try to pass it)

You have this

 $(document).ready{(function()};

You need this

 $(document).ready(function() { });
Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
0

Try this...

var isSplash = true;
$(document).ready(function(){
 if(location.hash.length === 0) {
    location.hash="!/"+$('#content > ul > li').eq(2).attr('id');
 }
});
Split Your Infinity
  • 4,159
  • 1
  • 21
  • 19