Introuction To jQuery

32
As a JavaScript library Shorthand & Utilities functions Document Object Model Elements, Attributes, Styles, Events Effects / Animation Asynchronous JavaScript And XML As an UI development framework Community Plugins Widgets & Themes Extending jQuery object

description

From DOM (Document Object Model) to HTML and CSS, with a MDC (Mozilla Developer Center) Re-introduction to JavaScript, to jQuery selectors, events and effects, plugins and comparison.

Transcript of Introuction To jQuery

Page 1: Introuction To jQuery

As a JavaScript library Shorthand & Utilities functions Document Object Model

Elements, Attributes, Styles, Events Effects / Animation Asynchronous JavaScript And XML

As an UI development framework Community Plugins Widgets & Themes Extending jQuery object

Page 2: Introuction To jQuery
Page 3: Introuction To jQuery

View in browser (frontend / user interface)

jQuery JavaScript (HTML + CSS) Document Object Model A Re-introduction to JavaScript $/jQuery at first sight CSS Selectors jQuery Selectors Traversing DOM DOM Attributes Event handling AJAX / Firebug Effects / jQuery UI Plugins / jqGrid Plugin: jQuery.fn.x

Page 4: Introuction To jQuery

Basic requirement Language neutral & platform independent

Document & content manipulation Can programmatically access & manipulate elements, attri

butes & content Event model

All elements can generate events Interface for binding events

Stylesheet object model Selectors, rules and properties of individual style sheets

can be added, removed and changed

Page 5: Introuction To jQuery

Document Object Model

Page 6: Introuction To jQuery

The world’s most misunderstood programming language - Douglas Crockford 2001

LiveScript / JavaScript / JScript / ECMAScript Name, Design Errors, Bad Books, Substandard

No concept of input or output Host environment scripting Can be Object-Oriented: prototype new delete Can have private variables & private methods Can use classical inheritance & other code reuse pa

tterns

Page 7: Introuction To jQuery
Page 8: Introuction To jQuery
Page 9: Introuction To jQuery

{ // JavaScript Object Notation name: value, key: obj, array: [true,1,'string',"str",[],{a:null}]}

Page 10: Introuction To jQuery
Page 11: Introuction To jQuery

$/jQuery at first sight

Page 12: Introuction To jQuery

jQuery as (an object-based) library document.getElementById(‘id’)

$(‘#id’) document.getElementsByTagName(‘tag’)

$(‘tag’) document.getElementsByClassName(‘cls’)

$(‘.cls’) elm.style.display = ‘none’

$(elm).css(‘display’, ‘none’) $(elm).hide() // .show()

elm.className = ‘cls’ $(elm).addClass(‘cls’) $(elm).removeClass(‘cls’) $(elm).hasClass(‘cls’) $(elm).toggleClass(‘cls’)

Page 13: Introuction To jQuery

CSS Selectors

Page 14: Introuction To jQuery

jQuery Selectors

Page 15: Introuction To jQuery

jQuery Selectors - Forms

Page 16: Introuction To jQuery

Traversing DOM (with firebug)

Page 17: Introuction To jQuery

Traversing DOM

Page 18: Introuction To jQuery

DOM Attributes

Page 19: Introuction To jQuery
Page 20: Introuction To jQuery

Event handling

Page 21: Introuction To jQuery

Event handling

Page 22: Introuction To jQuery

Asynchronous JavaScript And XML

Page 23: Introuction To jQuery

Asynchronous JavaScript And XML

Page 24: Introuction To jQuery

Utilities

$.trim(' some text ');

Page 25: Introuction To jQuery

Effects

Page 26: Introuction To jQuery
Page 27: Introuction To jQuery
Page 28: Introuction To jQuery
Page 29: Introuction To jQuery

Plugin: jQuery.fn.x

Page 30: Introuction To jQuery

Plugin: jQuery.fn.x

Page 31: Introuction To jQuery

As a JavaScript library Shorthand & Utilities functions Document Object Model

Elements, Attributes, Styles, Events Effects / Animation Asynchronous JavaScript And XML

As an UI development framework Community Plugins Widgets & Themes Extending jQuery object

Page 32: Introuction To jQuery