SYMBOLS
$() shortcut for jQuery() function 296, 299, 313, 361
$() conflicts with other scripts that use $() 361
$(document).ready(function(){…}) 312
$(function() { … }) (shortcut) 313, 364–5
[] Array syntax 72
[] Accessing an object's properties 103
{} Code blocks 57
{} Code block (function) 90
() Final parentheses (calling a function) 97
() Grouping operator 97
= Assignment operator 107
+= Operator (adding to a string) 111, 125
== Equal to (comparison operator) 150, 168
=== Strict equal to (comparison operator) 150, 168
!= Not equal to (comparison operator) 150, 168
!== Strict not equal to (comparison operator) 150, 168
> Greater than (comparison operator) 151
>= Greater than or equal to (comparison operator) 151
< Less than (comparison operator) 151
<= Less than or equal to (comparison operator) 151
&& Logical and (logical operators) 157, 158, 537
! Logical not (logical operators) 157, 159
|| Logical or (logical operators) 157, 159, 169
// (No http: in a url) 355
A
.abort() method (jqXHR object) 389
.accordion() (jQuery UI method) 430
action (DOM property – forms) 572
add() (option to select box) 584
.add() (jQuery method) 531
.addClass() (jQuery method) 320, 498, 512–3, 519, 565
addEventListener() (DOM method) 254–5, 570–1
Adding or removing HTML Content
innerHTML & DOM manipulation 218–225, 240–1
.after() (jQuery method) 318–9
Ajax
Data formats
.serialize() (jQuery method) 394
jqXHR object (see J > jqXHR object)
JSON object (see J > JSON > JSON object)
Relative URLs 389
Requests (loading data):
CORS (Cross Origin Resource Sharing) 384
JSON/JSONP from a remote server 385–8
Proxy for loading remote content 384
$.getScript() 392
XMLHttpRequest object
Methods
Properties
XDomainRequest object (IE8–9) 384
Alert box 125
.always() (jqXHR object) 389, 396–7
.animate() (jQuery method) 332, 334–5, 352–3, 493, 515, 520–1
API Keys 441
Console API 470
HTML5 APIs 413
Platform APIs 440
Scripts
Introduction to 428
.append() (jQuery method) 318, 565
.appendTo() (jQuery method) 318, 505, 519
appendChild() (DOM method) 222, 240
Arrays
Adding and removing items 530, 536–7, 540–3
Creating 72
split() method (String object) to create arrays 128–130, 546–7, 563, 618–9
Looping through an array 174–5, 535
Methods
concat() 530
every() 530
map() 530
pop() 530
shift() 530
some() 530
unshift() 530
Properties
Arrays and objects
Array-like objects (jQuery) 308, 340
Multiple return values from a function 95
vs variables and objects 116–7
Asynchronous loading (images) 509
Asynchronous processing 371
attachEvent() (IE8 event model) 255, 258–9, 570–1
Attributes
Creating / removing (DOM method) 232–5
Autocomplete (live search) 370
B
back() (history object) 426
.before() (jQuery method) 318
Behavior layer 44
blur() (DOM method) 573
blur event 247, 274–5, 282, 573, 588–9
break keyword 174
Browsers
Developer tools
Feature detection (see F > Feature detection)
JavaScript console 464–79 (see also C > Console)
Rendering engine 40
Scrollbars 350
Support in examples 10
Browser Object Model
history object 122, 124–5, 424–7
location object 122
navigator object 122
:button (jQuery selector) 342
C
Images (in custom object) 509–511
jQuery selections 308–9, 540–1
Calling a function 91
cancelable property (event object) 262
Case sensitivity 56
catch (error handling) 480–1, 576–7
ceil() (Math object) 134
Centering images 511
Chaining (jQuery methods) 311
change event 247, 282, 573, 576–7, 586–7
charAt() (String object) 128–130
:checkbox (jQuery selector) 342
:checked (jQuery selector) 342
checked (DOM property – forms) 573, 580–1
.children() (jQuery method) 336
clearTimeout() (window object) 517–9
.click() (jQuery method) 512–3
click() (DOM method) 573
click event 39, 246, 276–7, 573
clientX, clientY (event object) 278–9
.clone() (jQuery method) 346–7
.closest() (jQuery method) 336
Code dependencies 616
Code reuse 616
Collections
Color picker 591
Comments 57
Compare functions (sorting) 555–9
Checking equality 168
Operands 152
Truthy and falsy values 167
concat() (array object) 530
Conditional statements 149
Console
console.assert() 475
console.error() 472
console.group() 473
console.groupEnd() 473
console.info() 472
console.table() 474
console.warn() 472
debugger keyword 479
Constructor notation 106–111, 113
:contains() (jQuery selector) 338
Content layer 44
Content panels
Coordinates (geolocation API) 417–9
copy event 247
CORS (Cross Origin Resource Sharing) 384
Create attributes (DOM) 234
Create elements (DOM) 126, 222–3, 240
Create text nodes (DOM) 126, 222–3, 240
Cross-Site Scripting (XSS) Attacks 228–231
.css() (jQuery method) 322–3, 504–5, 510–1, 521
CSS
Box dimensions 348
CSS-style selectors in jQuery 302–3
Properties and values 9
Selectors to find elements (DOM) 193, 197, 202
Updating class names 189, 195, 232
Updating id attributes 189, 232
Updating styles (DOM) 195, 232
Updating styles (jQuery) 320–3, 497–9
Cut, copy, paste element (jQuery) 346–7
cut event 247
D
.data() (jQuery method) 546–7, 565, 602, 608–9
data-* attributes (HTML5) 289–90, 544–6, 608
Data binding (Angular) 437
Data models
Objects and properties 28, 102–5, 142
Data types
Complex data types
Objects (Arrays and functions) 131
Simple (primitive) data types
Null 131
Undefined 131
Type coercion and weak typing 166–7
Dates / Date object
Creating / Constructor 136, 138, 143
Date pickers 432–3, 591, 618–9
Difference between two dates 139, 143
Methods
getTime(), getMilliseconds(), getSeconds(),
getMinutes(), getHours(), getDate(), getDay(),
getMonth(), getFullYear(),
getTimeZoneOffset() 137
setTime(), setMilliseconds(), setSeconds(),
setMinutes(), setHours(), setDate(),
setMonth(), setFullYear(), toString(),
toTimeString(), toDateString() 137
dblclick event 246
Debugging
Errors and a debugging workflow 462–3
Tips 484
(see also Console and Troubleshooting)
defaultChecked (DOM property – forms) 573
defaultValue (DOM property – forms) 573
Delays
.delay() (jQuery method) 311, 332–3, 364
Delegating events 266–70, 290–1, 331
Design patterns 501
.detach() (jQuery method) 346, 502–3, 505
:disabled (jQuery selector) 342
disabled (DOM property – forms) 573, 578
disabled (JavaScript is disabled) 491
document object
Introduction to 36–9, 123, 126–7
Events
Methods
getElementById() 39, 126, 193–195
createElement(), createTextNode() 126, 222–3
querySelectorAll() 126, 193, 197, 202, 204–5
Properties
domain 126
DOM (document object model)
Introduction to 121, 126–7, 184, 186–7
Elements
Accessing
getElementsByClassName() 193, 197–9, 200
getElementsByTagName() 193, 197, 201
querySelectorAll() 193, 197, 202–3, 204–5
Adding
Creating
Updating
DOM manipulation 219, 222–5, 227
innerHTML 218, 220–1, 227, 228–31
textContent and innerText 216
class attribute/className property 195, 232
id property 232
Text nodes
createTextNode() 222
textContent and innerText 216–7
Document nodes 186
document object (see D > document object)
DOM queries
Performance (fastest route) 192
Caching DOM queries 190–1, 575
DOM tree
Inspecting (exploring – browser tools) 236–7
Traversing the DOM 208, 210–11
Events (see E > Events)
Event listeners 250, 254–5, 263, 265
length property 196
Live and static NodeLists 196
Selecting items from a NodeList 198–9
.done() (jqXHR object) 389, 405
Dot notation 103 (see also member operator)
DRY principle (don't repeat yourself) 616
E
.each() (jQuery method) 324–5, 333, 339, 498–9, 519, 531, 546–7
ECMAScript 532
Elements (see D> DOM > Elements and J > jQuery)
Finding elements (DOM) 192–203
Finding elements (jQuery) 296, 302–3, 336, 342
Form element content (jQuery) 342–5
Hiding/showing 332–3, 582–3, 618–9
Inserting new elements (jQuery) 318–9
Updating elements (jQuery) 313
elements collection (DOM property) 572, 574–5
.empty() (jQuery method) 346, 504–5
:enabled (jQuery selector) 342
.eq() (jQuery method) 340–1, 512–3, 521
equals sign (assignment operator) 61
Errors
Debugging workflow 462–3 (and tips 484–5)
NaN 461
Understanding errors 458
e (shorthand: event or error object) 328
Events
Introduction to 5, 30–31, 244–50
All events
DOMNodeInsertedIntoDocument 284
DOMNodeRemoved 284
DOMNodeRemovedFromDocument 284
DOMSubtreeModified 284
focus 274–5, 282, 588–9, 594–5
focusin 274
focusout 274
input 247, 271, 280–2, 552–3, 573, 588–9
keydown 280
keyup 280
mousedown 276
mouseout 276
mouseover 276
mouseup 276
scroll 272
unload 272
Delegation (DOM) 266, 268–71, 290–1
Delegation (jQuery) 330–1, 365
Event flow (bubbling and capturing) 260–1
Event handlers
DOM Event listeners 250, 254–5
Removing event listeners 255
Using parameters with events 256–7, 263
event object DOM 262–3, 265–70
Methods
preventDefault() 262, 267, 283
Properties
cancelable, clientX, clientY, pageX, pageY,
screenX, screenY, target, type 262, 278–9
event object (jQuery) 328–9, 331
Methods
.preventDefault() 328
.stopPropagation() 328
Properties
data, pageX, pageY, target, timeStamp,
type, which 328
IE8 event model
Cross-browser helper function 570–1
Property and method equivalents 262
jQuery (consider as alternative) 300–1
Performance (delegation) 266, 268–9, 290, 331
Terminology (fired, raised, triggered) 247
Which element user interacted with 262–70
every() (array object) 530
Exceptions (see Errors)
Comparing expressions 154
F
.fadeIn() (jQuery method) 298, 311, 332–7, 365
.fadeOut() (jQuery method) 332–3, 337, 510–11
.fadeTo() (jQuery method) 510–11
.fail() method (jqXHR object) 389, 396–7, 405
Feature detection
Feature detection (in jQuery) 301
Modernizr 414–5, 417, 419, 593, 596–7
:file (jQuery selector) 342
File extension
.js 46
.min.js 298
Filtering
Introduction to 534
filter() (array object) 530, 536–7
.filter() (jQuery method) 338–9, 343, 531, 548–9
finally (error handling) 480–1
Final parentheses 97
.find() (jQuery method) 336–7, 518–9, 564–5
Firebug 237
firstChild (DOM property) 188–9, 208–9, 211
floor() (Math object) 134–5, 139
.focus() (jQuery method) 326, 619
:focus (jQuery selector) 342
focus event 274–5, 282, 573, 588–9
focusin event 247
focusout event 247
forEach() (array object) 530, 536–7, 542–3
Forms
Controls (types of) 573
Changing type of form control 576–7
Date picker (HTML5) 591
Date picker (jQuery) 432–3, 619–9
Range inputs 591
elements collection 600
Enhancement
Introduction to 568
jQuery UI (Date picker & slider) 432–3
Password length and match 620–1
Show or hide based on other form input 618–9
Giving focus to an element 273, 326, 573, 619
Checking length of text input 615
Email 611
HTML5 form validation 590–1, 604–5
Length of text/password input 588–9, 620–1
Password length and match 615
test() and regular expressions 611–3
Turn off HTML5 validation 591
URL 590
Which element the user interacted with 576–7 (see also Event object)
forward() (history object) 426
Function-level scope 98
Functions
Anonymous functions 88
Code block 90
Final parentheses 97
initialize / init() 539, 542–3
return 92, 94–7, 578–9, 586–7, 594–5
this (scope of keyword) 270 (see also this keyword)
G
$.get() (jQuery method) 388, 392–3
getAttribute() (DOM method) 232–3
getCurrentPosition() (Geolocation API) 417–9
getDate() (Date object) 137
getDay() (Date object) 137
getElementById() (DOM method) 126, 192–5
getElementsByClassName() (DOM method) 193, 197, 200
getElementsByTagName() (DOM method) 193, 197, 201, 240
getFullYear() (Date object) 137–8
getHours() (Date object) 137
$.getJSON() (jQuery method) 388, 392, 396–7, 405
getMillseconds() (Date object) 137
getMinutes() (Date object) 137
getMonth() (Date object) 137
$.getScript() (jQuery method) 388, 392
getSeconds() (Date object) 137
getTime() (Date object) 137
getTimezoneOffset() (Date object) 137
Boolean object 123
Regex object 123
Global scope 98
go() (history object) 426
Grouping operator 97
H
:has() (jQuery selector) 338–9
hasAttribute() (DOM method) 232–3, 235
.hasClass() (jQuery method) 365
.height() (jQuery methods) 348–9, 350, 353
.hide() (jQuery method) 332–3, 512–3, 582–3, 618–9
history object (Browser Object Model) 124–5, 424–7
Methods
back(), forward(), go(),
pushState(), replaceState() 426
Properties
length 426
History stack 424
Hoisting 456
How many characters in a string 128–130
HTML5
APIs 413
Attributes
data-* attributes 289–90, 544–6, 608
Form controls (support, polyfills, styling) 590–2
I
if statements 148–9, 160–3, 181
:image (jQuery selector) 342
Images centering 511
Immediately Invoked Function Expressions (IIFE) 97, 142, 504, 523
Implicit iteration 310
.index() (jQuery method) 565
Index numbers 129
indexOf() (String object) 128–130, 550–3
Initialize / init() (functions) 539, 542–3
Inline scripts 49
.innerHeight() (jQuery methods) 348
innerHeight (window object) 124–5
innerHTML (DOM property) 218, 220–1, 227
Security risks 228
innerText (DOM property) 216–7
.innerWidth() (jQuery methods) 348
innerWidth (window object) 124–5
:input (jQuery selector) 342
input event 247, 271, 280–2, 552–3, 573, 588–9
insertBefore() (DOM method) 240
Interpreter
Definition 40
.is() (jQuery method) 343, 521, 565
isNaN() (Number object) 132
$.isNumeric() 343
item() (Array) 71
J
JavaScript History / Standards 532
JavaScript libraries 360–1, 428
JavaScript not enabled 491
jQuery
Introduction to 294, 296, 298–9
$() shortcut for jQuery() 296, 299, 313, 361
$(function() { … }); 313
Advantages 300
Ajax (see Ajax)
API 358
Chaining methods 311
Conflicts with other scripts 361
Documentation 358
Elements 302–3, 314–6, 318–9, 336–9, 342–7
Forms (.serialize()) 394
Global methods
$.getJSON() 388, 392, 396–7, 405
$.getScript() 388
$.isNumeric() 343
Implicit iteration 310
jQuery() function (see also $()) 296, 299, 313, 361
jQuery methods: full list of methods 304–5
jQuery selection (matched set) 296–7, 306
Adding to / filtering selection 338–341
Number of elements (length property) 364
jQuery selectors 296, 300, 302–3
jQuery Selectors: full list of selectors 302–3
jQuery UI 429
Accordion 430
Tabs 431
Looping
Through elements (implicit iteration) 310
Through elements .each() (see E > .each())
Matched set (see J > jQuery > jQuery selection)
Page is ready to work with 312–3
Date picker 619
noUISlider 538
Where to get / download 298, 354–5
Where to place script 313, 354–7
Methods
.abort(), .always(),
.overrideMimeType() 405
Properties
responseText, responseXML,
status, statusText 389
JSON
As an Ajax data format 374
Debugging JSON 474
JSON object
parse() & stringify() methods 377, 382–3
Serializing and deserializing data 382–3
K
keydown, keypress, keyup, input event 246–7
keys (objects) 101, 533, key/value pairs 118
Keywords
debugger 479
new (array) 71
return 92, 94–7, 578–9, 586–7, 594–5
throw 482
L
lastChild (DOM property) 208, 211
lastIndexOf() (String object) 128–130
length (history object) 124, 426
length (items in a select box) 584
length (String object) 128–130, 588–9, 620–1
Lexical scope 457
Lexicographic sort 554
Linking to a JavaScript file 47, 51, 298, 313, 354–7
Links
Get value of href attribute 407
Literal notation 102, 104–5, 113, 142
(see also O > Objects > Creating your own objects)
Livesearch (autocomplete) 370
.load() (jQuery method – Ajax) 388, 390–1, 407
Local scope 98–9 (see also p456–7)
Locale 137
location property (window object) 124–5
Short-circuit evaluation 157, 169
Loops
break keyword 174 (see also Keywords > break)
for loop 175
Looping through elements 204–7
Increment (++) 171
Infinite loop 174
jQuery implicit iteration 310
jQuery .each() method 324
Looping through
an array 175, 530, 534–7, 542–3
DOM elements (nodeList) 204–7, 594–5
properties of an object 533, 605
Performance 174
:lt() (jQuery selector) 340
M
map() (array object) 530
Matched set (jQuery) 296–7, 306–9, 338–41, 364
Methods
ceil(), floor(), random(),
round(), sqrt() 134
Properties
PI 134
method property (DOM property – forms) 572
Methods
Minification (.min.js extension) 298
Modernizr 414–5, 417, 419, 593, 596–7
Module pattern 501
mousedown, mousemove, mouseout,
mouseover, mouseup event 246, 276–7
multiple (DOM property – forms) 584
Multiplication 76–7, 176–7, 181
N
name (DOM property – forms) 572–3
Name/value pairs 28, 88–9, 101, 113, 116–8, 131
Naming conflicts (collisions) 97, 99, 361
navigator object (Browser Object Model) 122, 414, 417–9
.next() (jQuery method) 336–7, 495
.nextAll() (jQuery method) 336
nextSibling (DOM property) 208, 210, 214
Nodes (introduction to) 40, 186–7
nodeValue (DOM property) 184, 214–5, 241
No JavaScript 491
Non–blocking processing 371
.not() (jQuery method) 338, 494–5, 531
:not() (jQuery selectors) 338–9
novalidate property (HTML5 forms) 591, 604–5
Number object (Built-in Objects)
Methods
isNan(), toExponential(),
toFixed(), toPrecision() 132–3
Random numbers 135
Sorting 558
Numeric data type 62 (see also D > Data types)
O
Objects
Introduction to 26–9, 34–5, 100–1
Accessing properties and methods
Adding and removing properties 112
Arrays and objects 118–9, 308, 340, 533
Creating
Comparison of techniques 113
Constructor notation 106, 108–111, 113
Literal notation 102, 104–5, 113, 142
Creating your own objects (examples of)
Compare functions for sorting 562–3
Custom object for valid elements 601, 604–5
Data: cameras and projectors 586–7
Data: people for filtering 533–4
keys 101–2, 113, 117–8, 131, 533
Updating properties 107
Object models (introduction to) 121
.off() (jQuery method) 505
.offset() (jQuery methods) 351, 353
.on() (jQuery method) 326–31, 343–5, 365
onpopstate property (window object) 426–7
.open() (XMLHttpRequest object) 373, 379, 381, 383
Operators
+= adding to a string 111, 125, 127, 130, 133
> greater than, >= greater than or equal to 151–5
() grouping operator 97
< less than, <= less than or equal to 151
== is equal to, != is not equal to 150
=== strict equal to, !== strict not equal to 150
? : Ternary operator 562, 579, 583
Unary operator 168
options (DOM property – forms) 584
Order of execution 452
.outerHeight(), (jQuery method) 348
.outerWidth() (jQuery method) 348
.overrideMimeType() (jqXHR method) 405
P
Page loads – run script 273, 312–3
pageXOffset, pageYOffset (window object) 124–5
pageX, pageY (window object) 124, 278–9
.parent() (jQuery method) 336, 498–9
.parents() (jQuery method) 336
parentNode (DOM property) 208, 224–5
:password (jQuery selector) 342
paste event 247
Performance
Caching
jQuery selections 308–9, 540–1
Text (custom object) 551
Event delegation 266, 268–71, 290–1, 330–1, 365
Global vs Local variables 98–9
Selecting class and id attributes (jQuery vs DOM) 324
PI property (Math object) 134
placeholder (and its fallback) 590–1, 594–5
pop() (array object) 530
.position() (jQuery method) 351
Position object (geolocation API) 418–9
PositionError object (geolocation API) 418–9
Position of items on page 351–3
$.post() (jQuery method) 388, 392, 394–6
.prepend() & .prependTo() (jQuery methods) 318
Presentation layer 44
preventDefault() (event object) 262, 267, 283,
.preventDefault() (jQuery method) 328, 345, 365, 494–5, 504–5
previousSibling (DOM property) 208–10
Primitive data types (see Data types)
Progressive enhancement 45
Protocol relative URL 355
Proxy (Ajax) 384
push() (array object) 519, 530, 536–7, 540, 542–3
pushState() (history object) 424–7, 426
Q
querySelector() (DOM method) 193–6, 202, 241
querySelectorAll() (DOM method) 126, 193, 197
R
:radio (jQuery selector) 342
Random numbers 135
Range slider 432–3, 538, 542–3
.ready() (jQuery method) 312–3, 361, 364
Reference
To an element jQuery 308–9, 540–1
Regular expressions 563, 611–3
Relative URLs (Ajax) 389
Removing content:
.remove() (jQuery method) 299, 316–7, 346, 584
.removeAttr() (jQuery method) 320
removeAttribute() (DOM method) 232, 235
removeChild() (DOM method) 224–5
.removeClass() (jQuery method) 320–1, 339, 341, 512–3
removeEventListener() (DOM method) 255
(see also innerHTML an(d detach())
replace() (String object) 128–130, 406–7, 562–3
replaceState() method (history object) 424–6
.replaceWith() (jQuery method) 316
Require.js 593
:reset (jQuery selector) 342
reset() (DOM method – forms) 572
responseText (XMLHttpRequest object) 379, 383, 389
responseXML (XMLHttpRequest object) 380, 389
return keyword 92, 94–7, 578–9, 586–7, 594–5
reverse() (Array object) 530, 564–5
round() (Math object) 134
S
Same origin policy 420
Saving a script 46
IIFEs 97
Lexical scope 457
Local (function-level) scope 98–9, 453
Naming collisions and namespaces 99, 523
Screen dimensions 124–125, 278, 350
screen object (Browser Object Model) 124–5
Properties
height, width 124
screenX, screenY (window object) 124, 278
<script> element 47
Conditional loader for scripts 596–597
Where to place <script> tag 48, 51, 313, 354–7
Scripts
.scrollLeft() (jQuery method) 350
.scrollTop() (jQuery method) 350, 353
Security: Cross Site Scripting (CSS) Attack 228–231
select() (DOM method) 573
:selected (jQuery selector) 342
selected (DOM property – forms) 573, 580–3
selectedIndex (DOM property – forms) 584
selectedOptions (DOM property – forms) 584
select event 247
send() (XMLHttpRequest object) 373, 379, 381, 383
Separation of concerns 490
.serialize() (jQuery method - forms) 394–5
Serializing JSON data 382
setAttribute() (DOM method) 232, 234
setDate() (Date object) 137
setFullYear() (Date object) 137
setHours() (Date object) 137
setTime() (Date object) 137
setTimeout() (window object) 517–9
setMillseconds() (Date object) 137
setMinutes() (Date object) 137
setMonth() (Date object) 137
setSeconds() (Date object) 137
shift() (array object) 530
Short–circuit evaluation 157, 169
.show() (jQuery method) 332–3, 344, 364
.siblings() (jQuery method) 336, 548–9
Slider (content panel) 515–520
.slideToggle() (jQuery method) 494–5
some() (array object) 530
sort() (array object) 530, 533, 554–65
Dates 559
Lexicographic sort 554
Random order 558
split() (String object) 128–130, 546–7, 563, 618–9
sqrt() (Math object) 134
src attribute 47
Statements 56
.stop() (jQuery method) 332, 353, 510–1
stopPropagation() (DOM event object) 262, 267
.stopPropagation() (jQuery method) 328
Storage objects (storage API) 420–3
Storing data (compare techniques) 116–7
String object
Methods
charAt(), indexOf(), lastIndexOf(),
replace(), split(), substring(), trim(),
toLowerCase(), toUpperCase() 128–130
Properties
:submit (jQuery selector) 342
submit() (DOM method – forms) 572
submit event 247, 271, 282, 572
substring() (String object) 128–130
.complete() (jQuery method) 396
.error() (jQuery method) 396
.success() (jQuery method) 396
switch statements 164–165, 291
Switch value 165
Synchronous processing 371
T
Tables
.tabs() (jQuery UI method) 431
target property (event object) 262–3, 268–9
Ternary operator 562–3, 579, 583
Testing for features (see Feature detection) test() method 611
.text() (jQuery method) 314–7, 364–5, 535
:text (jQuery selector) 342
textContent (DOM property) 216–7
Timers (see Delays)
.toArray() (jQuery method) 531
toDateString() (Date object) 137
toExponential() (Number object) 132
toFixed() (Number object) 132
.toggle() (jQuery method) 332, 493
.toggleClass() (jQuery method) 565
toLowerCase() (String object) 128–130, 550–3
toPrecision() (Number object) 132
toString() (Date object) 137
toTimeString() (Date object) 137
toUpperCase() (String object) 128–130, 406
trim() (String object) 128–130, 552–3
Troubleshooting
Ajax not working in Chrome (locally) 378
Ajax requests: assets not showing up 389
Common errors 485 (see also 460–1)
Debugging JSON data and objects 474
Equivalent values do not match 166
Events firing more than once 260–1
IE will not run script locally 47
jQuery object only returns data from first element in selection 307
try (error handling) 480–1, 576–7
type (DOM property – forms) 573
type (event object) 262
U
UML (Unified Modeling Language) 494
unload event 246, 272 (see also beforeunload)
unshift() (array object) 530
.unwrap() (jQuery method) 346
Updating content (see DOM and jQuery)
Updating page without refreshing (see Ajax)
V
.val() (jQuery method) 343, 345, 365, 542–3
Validation (definition) 282, 568
value (DOM property – forms) 573, 574–5, 578–9
Variables
Assign a value / assignment operator 61
Declaration 60
Naming conflicts and collisions 97, 99
W
Where to place your scripts 356
.width() (jQuery methods) 348–50
window object (Browser Object Model) 36–7, 124–5
Methods
alert(), open(), print() 124
Properties
onpopstate 426
pageXOffset, pageYOffset 124
write() (document object) 126, 226
XYZ
XDomainRequest object (IE8–9) 384
XMLHttpRequest object
Methods
Properties
3.147.58.194