Appendix A. Learning jQuery

 

Because this is a book on jQuery UI and not jQuery Core, I assume the reader has some knowledge of the jQuery library before starting this book. Because I often get asked, “What’s the best way to learn jQuery?” I thought I’d gather a few of the resources that have worked for me.

A.1. Experimentation

Different people learn in different ways, but what has helped me is digging right into code. The appeal of jQuery is that it makes difficult tasks extraordinarily easy (its motto is write less, do more, after all!), and seeing results visually provides amazing feedback. Here are some of my favorite ways to experiment.

A.1.1. Try jQuery (try.jquery.com)

My go-to starting point for learning jQuery is Try jQuery—which is available at http://try.jquery.com. The great thing about Try jQuery is that it’s an interactive tutorial that you must actively participate in to advance. Figure A.1 shows an example exercise.

Figure A.1. An example exercise from Try jQuery about selecting elements

This example teaches how to select elements with jQuery; it specifically asks the user to select the <h2> element in the HTML provided. The user must type this in the console located at the bottom of the screen (which works the same as the browser’s developer tools that we’ll look at in a minute). In the screenshot, I have already typed the correct answer, $( "h2" ), and the UI responded with a success message and a Continue button that takes me to the next exercise.

A.2. Reading

sitemap