I've used quite a few resources in learning Javascript and jQuery; the books listed here are the ones I found most useful (and some of them are still useful even now). I've listed Javascript and jQuery books separately - I think it's better to have at least some knowledge of Javascript before starting to learn jQuery, although if you do any amount of front-end web development you're almost guaranteed to run across jQuery at some point.

jQuery

jQuery: Novice to Ninja jQuery: Novice to Ninja

jQuery: Novice to Ninja covers using jQuery in building a site - a nice contrast to the jQuery Cookbook, since this uses a concrete example to show how and why to use jQuery functionality.

This book really helped me understand jQuery - each chapter covers using a certain area of jQuery functionality, building on the previous chapters. It’s really useful for the example code, which clearly shows how functionality can be implemented, so is really useful for those beginning to learn jQuery.

The book also covers jQuery-UI (a library which provides more animations and layouts), and includes a jQuery reference at the end of the book.

jQuery cookbook jQuery Cookbook

The jQuery Cookbook contains various ‘recipes’ - sample code for common problems (such as form validation) along with an explanation of why the code is written in a certain way.

This makes the book useful for solving a specific problem, as well as giving an indication of what you could use jQuery for; however, it’s not a tutorial on jQuery (i.e. it expects you already know Javascript and possibly have used jQuery before) and so is probably not suitable for people trying to learn the basics (at least not straight away!).

However, it is useful for intermediate topics - for instance, patterns for creating your own jQuery plugins, or methods for optimising the code you write.

I wouldn’t recommend reading it cover-to-cover; it’s more suited for giving an answer to a specific problem.

Javascript

Eloquent Javascript Eloquent JavaScript

Eloquent Javascript is a comprehensive guide to learning Javascript - it starts with the basics and walks through different areas of the language in a progressive manner. The book also has a lot of exercises and projects to complete as you go, which build on what you learn through each chapter.

The real highlight of this book is it’s online version, which includes a console for you to write and run scripts as you follow the exercises. This is really useful for following the tutorials and experimenting with what you’ve just learnt.

Eloquent Javascript is mainly aimed at beginners, but is incredibly useful for shoring up knowledge if you already know Javascript.

Also available online for free.

Javascript: The Good Parts JavaScript: The Good Parts

Javascript: The Good Parts is written by Douglas Crockford (creator of JSON and JSLint, amongst others) and presents an overview of the Javascript language. Javascript has notoriously strange quirks in some areas of the language (see automatic semi-colon insertion!); ‘Good Parts’ covers how to get around these areas (as well as areas to avoid), but mainly focusses on areas in which Javascript is incredibly useful.

Throughout the book, Crockford demonstrates a coding style for Javascript, and explains why it’s important to follow that style (or something very similar) - mainly because of the pitfalls inherent in Javascript. This really helps explain why tools like JSLint (written by Crockford) proscribe certain coding styles, and why you should use them.

Javascript: The Good Parts has a lot to offer Javascript developers of every level - I’ve read through it a couple of times so far, and I still get a lot out of each read (mainly because I didn’t understand a lot the first time!). This book won’t teach you Javascript, but it will help you understand it better.

Javascript: The Definitive Guide JavaScript: The Definitive Guide

The Definitive Guide is an enormous book - I have the 6th edition which is over a thousand pages long! However, it really does cover absolutely everything you could need to know about Javascript - aspects of Javascript (for instance, the var keyword) are explained along with the syntax and why you would use it.

The second half of The Definitive Guide is a list of Javascript’s API (i.e. all the methods you could possibly use with Javascript); to be honest, I find the Mozilla Developer Network (MDN) to be a more useful reference - mainly because it’s easily searchable.

This is a comprehensive guide but absolutely huge - it’ll take a while to get through.