Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
jQuery
Search
Ryan L. Cross
September 19, 2012
Programming
430
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
jQuery
Ryan L. Cross
September 19, 2012
More Decks by Ryan L. Cross
See All by Ryan L. Cross
Nest & Hue
slant
0
110
Introduction to Ruby
slant
1
250
jQuery
slant
1
310
HTML and CSS
slant
1
230
Other Decks in Programming
See All in Programming
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
180
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
360
JavaDoc 再入門
nagise
1
420
AIで効率化できた業務・日常
ochtum
0
150
act1-costs.pdf
sumedhbala
0
120
Performance Engineering for Everyone
elenatanasoiu
0
230
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
410
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
180
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
160
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
190
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
110
エージェンティックRAGにAWSで入門しよう!
har1101
9
1.8k
Featured
See All Featured
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Faster Mobile Websites
deanohume
310
32k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
330
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
170
Everyday Curiosity
cassininazir
0
240
Why Our Code Smells
bkeepers
PRO
340
58k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
What's in a price? How to price your products and services
michaelherold
247
13k
Writing Fast Ruby
sferik
630
63k
The Curious Case for Waylosing
cassininazir
1
400
Transcript
Enclave Discussions by Ryan L. Cross Tuesday, September 18, 12
What is jQuery? j•Query noun \jā-ˈkwir-ē\ A fast and concise
JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. Tuesday, September 18, 12
The Players ‣ The jQuery object ‣ jQuery(document) ‣ $(document)
‣ Selectors ‣ $('div') ‣ Methods ‣ $('p').show() ‣ Method chaining ‣ $('p').val('Hello there').show() ‣ Functions ‣ function say(something) { alert(something) } ‣ (function(){ alert("Hello there!") })() Tuesday, September 18, 12
Selectors ‣ Element selector ‣ $('p') ‣ ID and Class
selectors ‣ $('div#things') ‣ $('p.note') ‣ Attribute selectors ‣ $('input[type=text]') ‣ Pseudo selectors ‣ $('input:focus') ‣ $('input:blur') ‣ Pseudo selectors ‣ $(':has(p)') http://api.jquery.com/category/selectors An extremely powerful way to specify which elements you want. <p>first</p> <p>second</p> <div id="things"></div> <p class="note"></p> <input type="text" /> <input /> <div><p></p></div> Tuesday, September 18, 12
Effects ‣ Show and hide ‣ $('#box').hide() ‣ $('#box').show() ‣
Fade ‣ $('#box').fadeOut() ‣ $('#box').fadeIn() ‣ Animate ‣ $('#box').animate( { opacity: 0.5 }, 5000, function(){ alert('It moved!') } ) http://api.jquery.com/category/effects Making things look pretty Tuesday, September 18, 12
Events ‣ Events in general ‣ $('button').click(function(){ alert('Clicked!') }) ‣
$('input').focus(function(){ alert('Please type a thing.') }) ‣ A problem ‣ $('.add-li').click(function(){ $('ul').append('<li class="cats"></li>') }) ‣ $('.cats').click(function(){ alert('Clicked!') }) ‣ bind() and live() ‣ $(...).bind(...) ‣ $(...).live(...) ‣ Introducing on() ‣ $('button').on('click', function(){ alert('Clicked!') }) http://api.jquery.com/category/events Responding to user actions Tuesday, September 18, 12
Hey document, are you ready? ‣ document object ‣ $(document).ready()
‣ $(document).ready(function(){ // do things here }) Tuesday, September 18, 12
AJAX ‣ AJAX requests ‣ $.ajax({ url: 'http://example.com/users.json', data: {
name: 'Ryan' }, type: 'post', complete: function(data, textStatus, jqxhr){ alert('Done!') } }) ‣ GET requests ‣ $.get('http://example.com/users.json') ‣ POST requests ‣ $.post( 'http://example.com/users.json', { name: 'Ryan' }, function(data){ alert('Done!') } ) ‣ load() ‣ $('#things').load('http://example.com/users.json') http://api.jquery.com/category/events How to communicate with an API Tuesday, September 18, 12
Live Demo Guaranteed to fail many times! Tuesday, September 18,
12
Fin Tuesday, September 18, 12
Ryan L. Cross github.com/cylence @slant Coming up next Oct 16,
2012 Backbone.js Nov 20, 2012 Node.js Tuesday, September 18, 12