作者:empty 页数:158 出版社:empty |
PrefaceThis book covers versa on 1.4ofthejQuery library for cint-side JavaScript programming It is one chapter from my muchlonger book JavaScript The Definitive Guide.jQuery is such apowerful libra ty and sowell suited to pocket reference for marthat it seemed worth publishing this material on its own.This book assumes that you already know howto programwith JavaScript, and that you are familiar with the basics ofchen t-side Java Se ripe programming without jQuery.Forex-ample, you should know about DOM methods lke get Elene ntBy Id() .get Ele nents By Tag Nane() , and addEventListener() .Thanks to Raffaele Cecco for a timely and thorough review ofthe book and of the code it contains.Thanks also to John Re sigand the entire y Query team for ct eating such a useful library,to my edt or Mike Lou kid es for his enthusiasm for this proje at,and to the OReilly production department forgetting thisbook out so quickly.
The examples in this book can be dowmload ed from the book'swebpage, which will also include errata if any errors are dis-covered after publication:In general, you may use the examples in this book in your programs and documentation.You do not need to contact us forpermission unless you're reproducing a significant portion ofhse caie we appr at.bufdonofreueaatauin
Introduction to jQueryJavaScript has an intentionally simple core API and an overlycomplicated chentsideAPltharismatred by major in compati bilities between browsers.The arrival of lE 9 eliminates theworst of those in compati bi ities, but many programmers findit easier to write web applications using a Java Seri pt frameworkor utility l brary to simplify common tasks and hide the differ-ences between browsers.At the time of this writing, j Que ty isone of the most popular and widely used of these libra ties.Because it has become so widely used, web developers shouldbefamiliarwiththejQuerylibraty:evenifyoudon'tuseitinyour own code, you are likely to encounter it in code wi tenby others.Fortunately, jQuery is sr able and small enough todocument in pocket reference formjQuery makes it ca syt of nd the clements of a document, andthen manipulate those elements by adding content, editingHTML at tab utes and CSS proper ics.de in mg event handle,and performing animations.It also has Ajax utilities for dy-na un ically making HTTP reques, and general purp use ultyfun e tions for working with obj eets and arrays.As its name imple s, the jQuery l brary is focused on queries.Atypical query uses a CSS selector to identify a set of documentelements and then returns an object that represents those ele-ments.This returned object provides many useful methods foroperating on the matching elements as a group.Wheneverposible, these mehodsreumtheobetonwhch they areinvoked, allowing a succinct method-chaining idiom to beused.These features are at the heart of jQuerys power and
Preface
Chapter1:IntroductiontojQuery
j Query Basics
The j Query() Function
Queries and Query Results
Chapter2:ElementGettersandSetters
Geting and Set tng HTML Attributes
Getting and Setting CSS Attributes
Getting and Setting CSS Classes
Getting and Setting HTML Form Values
Get tng and Seting Element Content
Getting and Seting Element Geomet y
Getting and S elting Element Data
Chapter3:AlteringDocumentStructure
Insert ng and Replacing Be ments
Copying Elements
Wrapping Element
Dele tig Elements
Chapter4:Events
Simple EventHandler Registration
j Query Event Handlers
The j Query EventObject
Advanced EventHandler Registrato n
De registering Event Handlers
Triggering Events
Custom Events
Live Events
Chapter5:AnimatedEffects
Simple Effects
Custom Animations
Canceling, Delaying, and Queuing Effecs
Chapter6:Ajax
The load O Method
Ajax U lity Funcion s
The j Query.ajax() Function
Ajax Events
Chapter7:UiyFunctins
Chapter8:SelectorsandSelecionMethods
j Query Selectors
Select on Me