jQuery notes

 jQuery notes




Contents

Chapter 1: Getting started with jQuery ............ 2

Section 1.1: Getting Started ............... 2

Section 1.2: Avoiding namespace collisions ..... 3

Section 1.3: jQuery Namespace ("jQuery" and "$") .............. 4

Section 1.4: Loading jQuery via console on a page that does not have it ............... 5

Section 1.5: Include script tag in head of HTML page ................. 5

Section 1.6: The jQuery Object ................ 7


Chapter 2: Selectors .................. 8

Section 2.1: Overview ................. 8

Section 2.2: Types of Selectors ................ 8

Section 2.3: Caching Selectors .............. 10

Section 2.4: Combining selectors ..............11

Section 2.5: DOM Elements as selectors ........ 13

Section 2.6: HTML strings as selectors ........ 13


Chapter 3: Each function .................. 15

Section 3.1: jQuery each function ............ 15


Chapter 4: Attributes ............... 16

Section 4.1: Dierece between attr() and prop() ................. 16

Section 4.2: Get the attribute value of a HTML element ................... 16

Section 4.3: Setting value of HTML attribute ........... 17

Section 4.4: Removing attribute ............... 17


Chapter 5: document-ready event .......... 18

Section 5.1: What is document-ready and how should I use it? ................. 18

Section 5.2: jQuery 2.2.3 and earlier ........... 18

Section 5.3: jQuery 3.0 ................... 19

Section 5.4: Attaching events and manipulating the DOM inside ready() ............... 19

Section 5.5: Dierence between $(document).ready() and $(window).load() ............ 20

Section 5.6: Dierence between jQuery(fn) and executing your code before </body> ........... 21


Chapter 6: Events ................. 22

Section 6.1: Delegated Events ................ 22

Section 6.2: Attach and Detach Event Handlers ....... 23

Section 6.3: Switching specific events on and o via jQuery. (Named Listeners) ................ 24

Section 6.4: original Event .............. 25

Section 6.5: Events for repeating elements without using ID's ................. 25

Section 6.6: Document Loading Event .load() ............ 26


Chapter 7: DOM Manipulation ................ 27

Section 7.1: Creating DOM elements ........... 27

Section 7.2: Manipulating element classes ......... 27

Section 7.3: Other API Methods ................. 29


Chapter 8: DOM Traversing .............. 31

Section 8.1: Select children of element ......... 31

Section 8.2: Get next element ................ 31

Section 8.3: Get previous element ............... 31

Section 8.4: Filter a selection ................. 32

Section 8.5: find() method ................ 33



                                             Download 


Post a Comment

0 Comments