On Aug 17, 5:55 am, Jackwanzai <jackwan...@gmail.com> wrote: > Hi all, > > I have been using JQuery for some time, finding it very interesting > and elegant. > > I want to study the code source. But found I was confused by many > code.
To really understand what jQuery is and how it works, one must also understand: A) What are HTML and the DOM? This include and understanding of its structure, as well as what types of elements are used for what purposes. jQuery is made for searching through and interacting with DOM elements, and to understand how it does this, one must understand the DOM. B) What is CSS, and how does it affect the HTML DOM? The "selectors" which jQuery uses were largely derived from CSS standards/conventions, and if one understands that then the selectors are easier to read and understand. C) What is JavaScript (and what is the difference between the JavaScript language and the DOM-defined JavaScript interface)? And how can we use it to interact with the objects from point (A). Also, understanding how closures and anonymous functions work in JS is critical to using jQuery properly. e.g. learn to identify which object "this" really points to. Don't try to understand jQuery simply be reading its source code (or the code for plugins). jQuery does a lot of tricks which are confusing to experienced JavaScript coders, and downright mystifying to newcomers. First understand what problem jQuery is trying to solve, then understanding jQuery should be a lot simpler.