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
nctunba
March 21, 2012
Programming
9
600
jQuery
nctunba
March 21, 2012
Tweet
Share
More Decks by nctunba
See All by nctunba
被 Qt 快樂的玩弄
nctunba
2
330
被 Qt 快樂的玩弄 part 1
nctunba
1
230
Node - Express - Socket.io
nctunba
1
410
Python
nctunba
3
510
node
nctunba
9
49k
JS
nctunba
11
600
Other Decks in Programming
See All in Programming
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
230
Ruby GitHub Packages
bkuhlmann
0
630
Git Rebase
bkuhlmann
11
1.6k
大規模Reactアプリのリアーキテクチャ~8万行のTanStack Query移行の軌跡~
kj455
4
970
サイコロで理解する統計的仮説検定の考え方
tatamiya
4
960
SwiftUIで使いやすいToastの作り方 / How to build a Toast system which is easy to use in SwiftUI
lovee
3
150
Hanami and htmx
bkuhlmann
0
210
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
27
8.3k
dbtのドメイン分割による データ基盤の改善とDigdagとの連携
sakama
0
370
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
360
Tailwind CSSを本気でカスタマイズする方法
fsubal
14
5.3k
Behind VS Code Extensions for JavaScript / TypeScript Linnting and Formatting
unvalley
5
1k
Featured
See All Featured
The Cult of Friendly URLs
andyhume
74
5.7k
Building Flexible Design Systems
yeseniaperezcruz
319
37k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
The Invisible Side of Design
smashingmag
294
49k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
17
1.4k
Producing Creativity
orderedlist
PRO
337
39k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
9
8.3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
2
3.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
Building an army of robots
kneath
300
41k
Transcript
jQuery
$
write less, do more
JavaScript Library
Client-side Scripting
Saves people's lifes since 2006
Does the dirty work for you
by “dirty work”, I mean W3C DOM
Document Object Model
Object Model for Documents
Object Model for HTML
HTML <=> DOM
HTML <=> DOM
HTML <=> DOM <=> JS
API between HTML & JS
W3C DOM
ugly & tedious
jQuery
jQuery Manipulation Attributes Effects Selectors Traversing Plugins Ajax Events
Install
None
<html> <head> <script src=”path/to/jquery”></script> </head> <body> </body> </html>
Hello World
DOM is a tree
|-> Document |-> <html> |-> <body> |-> <h1> |-> text
node |-> <p> |-> <a> |-> <br> |-> <a>
$('h1').text('hello world')
$('h1').text('hello world') Select and manipulate
$('h1').text('hello world') Select and manipulate
$ I am jQuery
$('h1') the Selector
.text('hello world') Set text
.text() Get text
var text = $('h1').text(); console.log(text);
$('h1') .text('hello') .fadeOut(); Chaining!
Selectors
Selects the nodes in the tree
Act just like CSS Selectors
$('h1') All h1 elements
$('p') All p elements
$('h1.banana') All h1 elements with class banana
$('h1#chuck') All h1 elements with id chuck
$('.banana') All elements with class banana
$('[type=”text”]') All elements with attribute type = text
Manipulations
Play with a node
CSS
How a node looks like
Traversing
Visit other nodes
Events
Nodes are responsive
$(...).someEvent(callback)
Ajax
Grabs you data