Chapter 2. Selectors and Methods: Grab and Go
jQuery helps you grab web page elements and do all kinds of things with them. In this chapter, we’ll dig into jQuery selectors and methods. With jQuery selectors, we can grab elements on our page, and with methods we can do stuff to those elements. Like a massive book of magic spells, the jQuery library lets us change tons of things on the fly. We can make images disappear and reappear out of thin air. We can select a certain piece of text and animate the change to its font size. So, on with the show—let’s grab some web page elements and go!
Jump for Joy needs your help
You receive an email from your friend, who is a professional portrait photographer. She wants to roll out a “Jump for Joy” promotion that allows users to win deals on a package of prints. She needs your help making the promotion work.
Subject: Jump for Joy Promotion!
I saw your tweet that you’re doing more interactive web work these days, so I was hoping you could help me with making some interactive stuff for the “Jump for Joy” promotion on my website. I’d like to give my visitors a chance to receive a discount off their purchase before they check out, to encourage them to click around the site some more (and hopefully buy more as a result!).
The page should have four sections with one of four images per section. I need a message that says “Your Discount is” ...