Unexpected Token ;


#1

Could someone help me figure out what is wrong with my code. I can't see anything wrong with it but a red error message saying uncaught syntax error: unexpected token ;
The menu bar won't open at all but yet the course is letting me continue so I don't understand why there is an error message.

var main = function() {

$('.icon-menu').click(function();
    $('.menu').animate({
        left: '0px'}, 200); /* move left 0px over 200ms */

    $('.body').animate({
        left: '285px'}, 200);    

   };

$(document).ready(main);

Thanks everyone!


#2

It's ok everyone, I figured out my mistake. Below code is now correct (and includes the next step of closing the menu animation).

My mistake was the (function(); should have been (function() {

var main = function() {
/* Animation to open the menu */

$('.icon-menu').click(function() {
    $('.menu').animate({
        left: '0px'}, 200); /* move left 0px over 200ms */

    $('body').animate({
        left: '285px'}, 200);    

   }); /* This is the close of the click function. The }
   was opened last and so it is closed before the ) */

/* Animation to close the menu */   
$('.icon-close').click(function() {
    $('.menu').animate( {
        left: '-285px' }, 200);
    $('body').animate( {
        left: '0px' }, 200);
});

};