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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
Creating Composable Callables in Contemporary C++
rollbear
0
170
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.5k
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
190
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
270
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
140
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
210
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
120
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
170
Webフレームワークの ベンチマークについて
yusukebe
0
180
エージェンティックRAGにAWSで入門しよう!
har1101
9
1.8k
Vite+ Unified Toolchain for the Web
naokihaba
0
360
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
320
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
From π to Pie charts
rasagy
0
220
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
RailsConf 2023
tenderlove
30
1.5k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
Being A Developer After 40
akosma
91
590k
Paper Plane (Part 1)
katiecoart
PRO
0
9.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
The Curious Case for Waylosing
cassininazir
1
400
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
210
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