First, visit http://www.jquery.com and download the framework. You’ll also see what jQuery code looks like in action.
With over 80% of sites using jQuery, it has become the go-to framework for adding behavior and interactivity to your website.
Andrew: Hi, I’m Andrew. In this Treehouse quick tip we’re talking about
offers a simple way to add behavior to a website’s cross browser using the
same CSS selectors web developers are familar with. In other words, you can
write less and do more.
To get started with jQuery, visit jquery.com and straight off the bat you
can see what jQuery code looks like. If we right click and inspect the code
of this site, we can see the paragraph with the class “neat” and it’s
hidden with display “non”. Let’s see what happens when we hit “run code”.
As you can see, the paragraph has “oh my” [SP] added to its class
attribute, and the paragraph is shown. The $(“P.neat”) is jQuery selecting
the element you want to manipulate and add behavior to. The add class
method adds the class name you want to pass in as an argument. So, in this
case “Oh My” is added. Now, “neat” is still there, too, and the show method
with this speed of slow is passed in to show the hidden paragraph.
Notice that the methods are chained together, resulting in less lines of
code. What you can do in a line of jQuery, often amounts to lines and lines
an extra download instead of reinventing the wheel, implementing your own
cross browser framework. With over 80% of sites using jQuery, it’s become
the go-to framework when adding behavior and interactivity to websites. So,
what are you waiting for? Go download it now and try it out on your next
Announcer: If you’d like to see more advanced videos and tutorials like
this one, go to TeamTreehouse.com and start learning for free.