Jay Hankins
Jay Hankins

Reputation: 23

Why does this code give an error?

$("#main").animate({ 
display: "block",
width: "70%",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em", 
borderWidth: "10px"
} 1500);

This is jQuery. I get a "missing ) after arguement list" message. What's wrong?

Upvotes: 1

Views: 95

Answers (3)

Reigel Gallarde
Reigel Gallarde

Reputation: 65254

$("#main").animate({ 
display: "block",
width: "70%",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em", 
borderWidth: "10px"
}, 1500); // you have forgotten the comma here...

Upvotes: 3

Nick Craver
Nick Craver

Reputation: 630379

You need a comma before the duration at the end (currently } 1500);), like this:

$("#main").animate({ 
display: "block",
width: "70%",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em", 
borderWidth: "10px"
}, 1500);

Upvotes: 3

mkoryak
mkoryak

Reputation: 57928

umm

} 1500);

missing comma before 1500

may i suggest using http://www.jslint.com/ for this in the future? if you paste in that code block in there you will get the following errors:

Error:
Problem at line 8 character 3: Expected ')' and instead saw '1500'.

} 1500);

Problem at line 8 character 7: Missing semicolon.

} 1500);

Problem at line 8 character 7: Expected an identifier and instead saw ')'.

} 1500);

Problem at line 8 character 7: Stopping, unable to continue. (100% scanned).

Implied global: $ 1

after that, it its pretty easy to see that your error must be on line 8..

Upvotes: 6

Related Questions