jQuery in Action
12
CHAPTER 1
Introducing jQuery
We'll be investigating the full set of 
DOM
 manipulation functions in chapter 2, 
where you'll see that jQuery provides many means to manipulate the 
DOM
 to 
achieve about any structure that we may desire.
 Now that you've seen the basic syntax of jQuery, let's take a look at one of the 
most powerful features of the library.
1.3.5 Extending jQuery
The 
jQuery
 wrapper function provides a large number of useful functions we'll 
find ourselves using again and again in our pages. But no library can anticipate 
everyone's needs. It could be argued that no library should even try to anticipate
every possible need; doing so could result in a large, clunky mass of code that
contains little-used features that merely serve to gum up the works!
everyone's needs. It could be argued that no library should even try to anticipate
every possible need; doing so could result in a large, clunky mass of code that
contains little-used features that merely serve to gum up the works!
 The authors of the jQuery library recognized this concept and worked hard to 
identify the features that most page authors would need and included only those 
needs in the core library. Recognizing also that page authors would each have
their own unique needs, jQuery was designed to be easily extended with addi-
tional functionality.
needs in the core library. Recognizing also that page authors would each have
their own unique needs, jQuery was designed to be easily extended with addi-
tional functionality.
 But why extend jQuery versus writing standalone functions to fill in any gaps?
That's an easy one! By extending jQuery, we can use the powerful features it
That's an easy one! By extending jQuery, we can use the powerful features it
provides, particularly in the area of element selection.
 Let's look at a particular example: jQuery doesn't come with a predefined func-
tion to disable a group of form elements. And if we're using forms throughout our 
application, we might find it convenient to be able to use the following syntax:
application, we might find it convenient to be able to use the following syntax:
$("form#myForm input.special").disable();
Figure 1.2 
A dynamically created 
and inserted element
and inserted element