作者:empty 页数:158 出版社:empty |
As someone ubo use Query on a regular basi, it was sur pr singlodi scorer bow m ucb of the library Tm not using This boot isindi pens able for anyone u bois serious about using j Query fornontrivial applications”Raffaele Ceccoi Query is the write less, do more JavaScript library.lts powerfull eatures and ease of use have made it the most popular JavaScriptframework for the Web.This book is j Querys trusty companion:the defini ive Tread less, learn more guide to the lira ry.J Query Po chet Reference explains everything you need to knowaboutjQuery.
This book covers versa on 1.4ofthej Query library for cint-side JavaScript programming It is one chapter from my muchlonger book JavaScript The Definitive Guide.j Query 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 j Query.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.
Introduction to jQuery
JavaScript 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, j Query is sr able and small enough todocument in pocket reference formj Query 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 j Query 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 j Querys power andutility:·An expressive syntax(CSS selectors) for refe ming to·An efficient query method for finding the set of document·A useful set af methods far manipuLating selected·Powerful functional programming techniques for operat-clemens sin the documentelements thar match a CSS selectorelementsing on sets of elements as a group, rather than on cat at in e·A succinct idiom(method chaining) for expressingsequence sol operationsThis book begins with an introduction to j Query that showshowto make simple queries and work with the results Thechapters that follow explain:·Howto set HTML attributes; CSS styles and classes,HTML form values, and element content, geometry, anddata·Howto alter the structure of a document by inserting,replacing, wrapping.and deleting elements·Howto use j Query's crass-browser event model·Howto produce animated visual effects with j Query·j Que ty'sAjax uul ities for making ser ip ted HTTP requests·j Query's utility functions·The full syntax of j Query's selectors, and howto usej Query's advanced selection methods·Howto extend j Query by using and writing plugins·The j Query UI libraryThe end of this book is aquis k reference to all of j Querysmethods and functions.
Chapter1:IntroductiontojQuery
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 Methods
Chapter9:ExtendingjQuerywithPlugins
Chapter10:ThejQueryUILibrary
Chapter11:jQueryQuickReference
Factory Function