jQuery: “missing : after property id” Error

I didn’t realize how rusty one could get in just a week!

This is the code I was trying to use — a function I’ve used hundreds of times — and I kept getting the “missing : after property id” error.

$(document).ready({
});

Did you catch it? Neither did I ;-)

Well, according to the jQuery API the .ready() function takes a function — do you see my error now?

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

Kudos to user113716 for [indirectly] pointing out my flaw, and with that silly bug I’m off to get another cup of caffeine.

Nick

Leave a Reply