Winnipeg Photographer


How to read jQuery for Beginners (Part 2)

Did you check out Part 1 of How to read jQuery for Beginners?

Did you know that jQuery can change CSS on your page on the fly? There is a handy function called “CSS”.

jQuery

How to read jQuery for Beginners Part 2 01

This is how to read this piece of code:

Line 1: When the document is ready run some jQuery Code.

Line 2: If a Hyperlink is clicked, get ready and run everything inside this section

Line 3 – All Anchor Tags that are wrapped inside paragraph tags you will switch the font color to red using the jQuery css function.

Heres some xhtml and css that would work with the jQuery:

xhtml

How to read jQuery for Beginners Part 2 02

CSS

How to read jQuery for Beginners Part 2 03

This is what the initial output would look like:

image

This is what would happen after you click either “Click me!” ‘s.

image

In my case I clicked the first one. Notice how both changed?


Leave a Reply