JQuery notes from Codecademy

Getting Started

Next, we’ll need to start up our jQuery magic using the $(document).ready();syntax you’ve seen. It works like this:

  • $() says, “hey, jQuery things are about to happen!”
  • Putting document between the parentheses tells us that we’re about to work our magic on the HTML documentitself.
  • .ready(); is a function, or basic action, in jQuery. It says “hey, I’m going to do stuff as soon as the HTML document is ready!”
  • Whatever goes in .ready()‘s parentheses is the jQuery event that occurs as soon as the HTML document is ready.

So,

$(document).ready(something);

says: “when the HTML document is ready, do something!” (We’ll show you how to replace something with an action in the next exercise.)

Note that .ready(); ends with a semicolon. This tells jQuery that you’re done giving it a command.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s