Tutorials

JavaScript

You probably remember from the overview that HTML, CSS, and JavaScript all have their unique role in creating websites.

If we think about a metaphor of building, decorating, and living in a house...

HTML is like the house skeleton. It asks, "What are the things? What is their structure?" HTML gives semantic meaning and order to things.

CSS is like the interior design of the house... applying colors, textiles, and other stylistic choices to the default skeleton. It asks, "How do the things look?"

Finally, JS (JavaScript) gives life to the house... maybe it's like the home's devices like lamps, thermostats, and other smart devices. These devices have internal instructions, operating according to changing conditions. JS asks, "How do the things behave?"


This time, I don't have a write-up, but just some PDFs I've created (with TAs) for past classes I've taught. I hope it's useful!


jQuery

jQuery is a "JavaScript Library" which essentially means it's a JavaScript file you include in your code that allows you to more easily write certain types of JavaScript. So you can do more with less. Specifically, jQuery is good at doing immediate, visual things, which is why it makes sense for this class.

Tutorial

jQuery Tutorial PDF

Examples

jQuery: Click a button and toggle

jQuery: Mouseenter, mouseleave

jQuery: Hover

jQuery: Scroll and alert

jQuery: Accordion slideToggle

jQuery: Turn on and off lights with button

jQuery: Change background color

Exercise

jQuery Exercise / "Puzzle"

(open up js/script.js and follow the prompts in the comments)


"Vanilla" JavaScript

JavaScript, when not used with a library, is sometimes called "Vanilla JavaScript". The syntax is not as easy to learn as jQuery, but feel free to try it out:

JavaScript Tutorial PDF