jQuery For Dummies
xiv
Setting element attribute values ........................................................28
Removing element attribute values ...................................................29
Changing HTML Content ...............................................................................30
Changing Text Content .................................................................................32
Chapter 3: Selecting HTML Elements, Attributes, and Positions . . . .35
Using jQuery Selectors ..................................................................................35
Selecting speci c element types ........................................................36
Selecting all elements ..........................................................................38
Selecting an id ......................................................................................39
Selecting classes ..................................................................................40
Selecting by order ................................................................................43
Selecting from Forms ....................................................................................46
Selecting Attributes .......................................................................................47
Selecting Visibility .........................................................................................48
Selecting Parents and Children ....................................................................48
Chapter 4: Managing Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
Using jQuery When the Page Loads ............................................................51
Handling Events .............................................................................................52
Clicking and double-clicking ...............................................................53
Giving an element focus ......................................................................57
Detecting a keyboard event ................................................................59
Detecting a mouse event .....................................................................61
Working with Interaction Helpers ...............................................................63
Hovering ................................................................................................63
Toggling functions ...............................................................................65
Part II: Affecting Elements with Effects ....................... 69
Chapter 5: Playing Hide-and-Seek with Web Page Elements. . . . . . .71
Hiding Elements with jQuery .......................................................................71
Hiding an element by type with a button .........................................71
Hiding an element by
id when clicked..............................................74
Hiding an element by using the
this keyword ................................76
Hiding an element with animation .....................................................76
Showing Elements with jQuery ....................................................................79
Showing an element by id ...................................................................79
Showing an element with animation .................................................81
Toggling Visibility with jQuery ....................................................................83
Using a toggle .......................................................................................84
Toggling with animation .....................................................................86
Using a callback function ....................................................................88
www.it-ebooks.info