jQuery

An Introduction

John A. Vieth

University of Wisconsin-Platteville

Use arrow keys (left and right) to navigate through slides and bullets in this presentation!!!

Who am I?

Notes




What is this?!?

Notes




What is jQuery?

Notes




John Resig

Pancakes

Notes




Benefits of jQuery

Notes




What makes jQuery special?

Notes




Good Company

Pancakes

Notes




Primary Features of jQuery

Notes




Installation

Notes




Demo: Getting Started

Notes




What is the dollar sign?

Notes




$(document).ready Event Handler

Notes




Demo: Selecting, Changing CSS

Notes




Selectors and Filters

Notes




Examples of Selectors

Type Example
SIMPLE $("#MainDiv")
OR $("p, ul")
AND $(".ClassA.ClassB")
CHILDREN $("#MainDiv > p")
SUBELEMENTS $("#MainDiv a")
ADJACENT $(".NoMargins + p")
FOLLOWER $("p.FirstParagraph ~ p)

See documentation on selectors and filters at docs.jquery.com/Selectors

Notes




Examples of Filters

Notes




Examples of Filters (continued)

Notes




Counting or Checking for Elements

Notes




css() Function

Example What It Does
css(property) Returns the value of the named CSS property of the first matched element
css(property, value) Sets the value of the named CSS property of all matched elements to the value specified

Notes




More CSS Functions

Function What It Does
addClass(classname) Adds specified class(es) to all matched elements
removeClass(classname) Removes specified class(es) from all matched elements
hasClass(classname) Returns boolean (true/false) value for all matched elements
toggleClass(classname) Adds class like "addClass" if class not present and removes the class like "removeClass" if it is already present

Notes




Chaining

Notes




"Each" Processes Each Element

Notes




Demo: Changing Content

Notes




Changing Content

Function What It Does
html() Gets or sets the HTML content of matched elements
text() Gets or sets the text content of matched elements
attr() Gets or sets an attribute of matched elements
empty() Removes all child nodes from matched elements
remove() Removes matched elements and any nodes inside those elements
clone() Makes a copy of selected elements that can then be inserted into the DOM elsewhwere

Notes




Changing Content (continued)

Function What It Does
append() Appends content to the inside of matched elements
appendTo() Removes matched elements and appends them to inside of specified target
prepend() Prepends content to the inside of matched elements
prependTo() Removes matched elements and prepends them to inside of specified target

Notes




Changing Content (continued)

Function What It Does
after() Inserts content after each of the matched elements
before() Inserts content before each of the matched elements
insertAfter() Removes matched elements and inserts them after each of the specified elements
insertBefore() Removes matched elements and inserts them before each of the specified elements

Notes




Size and Positioning

Notes




Demo: Event Handlers

Notes




Event Handling

Notes




Animation and Effects

Notes




Animation and Effects (continued)

Notes




Demo: Show and Hide

Notes




AJAX-ish Stuff

Notes




Demo: Easy AJAX Using load()

Notes




jQuery UI Library

Notes




My Favorite jQuery Plug-ins

Notes




Using jQuery for UWP DLC redesign

Notes




More Information

Notes




Questions?

Sasquatch

Notes