100% found this document useful (3 votes)
38 views53 pages

Jquery and JavaScript Phrasebook 1st Edition by Brad Dayley ISBN 0133410854 9780133410853 Instant Download

The document provides links to various eBooks related to jQuery and JavaScript, including titles like 'jQuery and JavaScript Phrasebook' by Brad Dayley and 'JavaScript and jQuery: The Missing Manual' by David Sawyer McFarland. It includes ISBN information and encourages users to explore more eBooks on the website ebookball.com. Additionally, it contains a brief overview of the contents of the 'jQuery and JavaScript Phrasebook' and information about the author.

Uploaded by

laityfantu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
38 views53 pages

Jquery and JavaScript Phrasebook 1st Edition by Brad Dayley ISBN 0133410854 9780133410853 Instant Download

The document provides links to various eBooks related to jQuery and JavaScript, including titles like 'jQuery and JavaScript Phrasebook' by Brad Dayley and 'JavaScript and jQuery: The Missing Manual' by David Sawyer McFarland. It includes ISBN information and encourages users to explore more eBooks on the website ebookball.com. Additionally, it contains a brief overview of the contents of the 'jQuery and JavaScript Phrasebook' and information about the author.

Uploaded by

laityfantu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

jQuery and JavaScript Phrasebook 1st Edition by

Brad Dayley ISBN 0133410854 9780133410853 pdf


download

https://ebookball.com/product/jquery-and-javascript-
phrasebook-1st-edition-by-brad-dayley-
isbn-0133410854-9780133410853-12804/

Explore and download more ebooks or textbooks


at ebookball.com
We have selected some products that you may be interested in
Click the link to download now or visit ebookball.com
for more options!.

JavaScript and jQuery The Missing Manual 2nd Edition by


McFarland, David Sawyer ISBN 1449399029 9781449399023

https://ebookball.com/product/javascript-and-jquery-the-missing-
manual-2nd-edition-by-mcfarland-david-sawyer-
isbn-1449399029-9781449399023-11302/

JavaScript and jQuery Interactive Front End Web


Development 1st Edition by Jon Duckett ISBN 1118531647
9781118531648
https://ebookball.com/product/javascript-and-jquery-interactive-front-
end-web-development-1st-edition-by-jon-duckett-
isbn-1118531647-9781118531648-16160/

Linux Phrasebook 1st edition by Scott Granneman 0672328380


978-0672328381

https://ebookball.com/product/linux-phrasebook-1st-edition-by-scott-
granneman-0672328380-978-0672328381-12390/

jQuery Succinctly 1st Edition by Cody Lindley

https://ebookball.com/product/jquery-succinctly-1st-edition-by-cody-
lindley-11772/
(Ebook PDF) jQuery Game Development Essentials Learn how
to make fun and addictive multi platform games using
jQuery 1st edition by Selim Arsever 1849695075
9781849695077 full chapters
https://ebookball.com/product/ebook-pdf-jquery-game-development-
essentials-learn-how-to-make-fun-and-addictive-multi-platform-games-
using-jquery-1st-edition-by-selim-
arsever-1849695075-9781849695077-full-chapters-22620/

JavaScript and Node FUNdamentals 1st Edition by Azat


Mardan ISBN B00HDYHKN6

https://ebookball.com/product/javascript-and-node-fundamentals-1st-
edition-by-azat-mardan-isbn-b00hdyhkn6-13414/

Jquery Novice to Ninja 1st Edition by Earle Castledine,


Craig Sharkie ISBN 0980576857 9780980576856

https://ebookball.com/product/jquery-novice-to-ninja-1st-edition-by-
earle-castledine-craig-sharkie-isbn-0980576857-9780980576856-10900/

JavaScript and Ajax for Dummies 1st Edition by Andy Harris


ISBN 0470417994 9780470417997

https://ebookball.com/product/javascript-and-ajax-for-dummies-1st-
edition-by-andy-harris-isbn-0470417994-9780470417997-13728/

JavaScript Mini FAQ 1st Edition by Danny Goodman ISBN

https://ebookball.com/product/javascript-mini-faq-1st-edition-by-
danny-goodman-isbn-11420/
jQuery and
JavaScript
P H R A S E B O O K
This page intentionally left blank
jQuery and
JavaScript
P H R A S E B O O K

Brad Dayley

Upper Saddle River, NJ • Boston • Indianapolis • San Francisco


New York • Toronto • Montreal • London • Munich • Paris • Madrid
Cape Town • Sydney • Tokyo • Singapore • Mexico City
Many of the designations used by manufacturers and sellers to distinguish their
products are claimed as trademarks. Where those designations appear in this book,
and the publisher was aware of a trademark claim, the designations have been print-
ed with initial capital letters or in all capitals.
The author and publisher have taken care in the preparation of this book, but make
no expressed or implied warranty of any kind and assume no responsibility for errors
or omissions. No liability is assumed for incidental or consequential damages in
connection with or arising out of the use of the information or programs contained
herein.
For information about buying this title in bulk quantities, or for special sales
opportunities (which may include electronic versions; custom cover designs;
and content particular to your business, training goals, marketing focus,
or branding interests), please contact our corporate sales department at
[email protected] or (800) 382-3419.
For government sales inquiries, please contact [email protected].
For questions about sales outside the U.S., please contact
[email protected].
Visit us on the Web: informit.com/aw
Library of Congress Control Number: 2013950281
Copyright © 2014 Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is
protected by copyright, and permission must be obtained from the publisher prior to
any prohibited reproduction, storage in a retrieval system, or transmission in any
form or by any means, electronic, mechanical, photocopying, recording, or likewise.
To obtain permission to use material from this work, please submit a written request
to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle
River, New Jersey 07458, or you may fax your request to (201) 236-3290.
ISBN-13: 978-0-321-91896-3
ISBN-10: 0-321-91896-7

First printing: December 2013

Acquisitions Editor Copy Editor Proofreader Cover Designer


Mark Taber Karen Gill Kathy Ruiz Chuti Prasertsith
Managing Editor Indexer Technical Senior Compositor
Kristy Hart Publishing Reviewer Gloria Schurick
Project Editor Services, Phil Ballard
WordWise, Editorial Assistant
Katie Matejka Larry Sweazy
Vanessa Evans
Dedication

For D!
A&F
Contents
1 Jumping into jQuery, JavaScript, and the
World of Dynamic Web Development 1
Understanding JavaScript 2
Introducing jQuery 4
Introducing jQuery UI 7
Introducing jQuery Mobile 9
Configuring Browser Development Tools 12

2 Using the JavaScript Language 15


JavaScript Syntax 15
Defining and Accessing Data 16
Defining Functions 20
Manipulating Strings 21
Manipulating Arrays 25
Applying Logic 29
Math Operations 31
Working with Dates 36

3 Interacting with the Browser 43


Writing to the JavaScript Console 43
Reloading the Web Page 44
Redirecting the Web Page 44
Getting the Screen Size 45
Getting Current Location Details 45
Accessing the Browser 47
Using the Browser History to Go Forward and
Backward Pages 49
Creating Popup Windows 50
Manipulating Cookies 52
Adding Timers 55
Contents vii

4 Accessing HTML Elements 59


Finding HTML Elements in JavaScript 59
Using the jQuery Selector to Find HTML
Elements 61
Chaining jQuery Object Operations 75
Navigating jQuery Objects to Select Elements 76

5 Manipulating the jQuery Object Set 83


Getting DOM Objects from a jQuery
Object Set 84
Converting DOM Objects into jQuery Objects 84
Iterating Through the jQuery Object Set
Using .each() 85
Using .map() 87
Assigning Data Values to Objects 89
Adding DOM Elements to the jQuery
Object Set 91
Removing Objects from the jQuery
Object Set 91
Filtering the jQuery Object Results 92

6 Capturing and Using Browser and


User Events 95
Understanding Events 96
Adding Event Handlers 99
Controlling Events 107
Using Event Objects 111
Handling Mouse Events 115
Handling Keyboard Events 118
Form Events 122

7 Manipulating Web Page Elements


Dynamically 125
Getting and Setting DOM Element Attributes
and Properties 126
viii Contents

Getting and Setting CSS Properties 130


Getting and Manipulating Element Content 139

8 Manipulating Web Page Layout Dynamically 143


Hiding and Showing Elements 143
Adjusting Opacity 146
Resizing Elements 149
Repositioning Elements 152
Stacking Elements 156

9 Dynamically Working with Form Elements 159


Getting and Setting Text Input Values 160
Checking and Changing Check Box State 161
Getting and Setting the Selected Option
in a Radio Group 162
Getting and Setting Select Values 164
Getting and Setting Hidden Form Attributes 166
Disabling Form Elements 167
Showing/Hiding Form Elements 170
Forcing Focus to and Away from
Form Elements 172
Controlling Form Submission 175

10 Building Web Page Content Dynamically 177


Creating HTML Elements Using jQuery 178
Adding Elements to the Other Elements 179
Removing Elements from the Page 184
Dynamically Creating a Select Form Element 186
Appending Rows to a Table 189
Inserting Items into a List 191
Creating a Dynamic Image Gallery 193
Adding HTML5 Canvas Graphics 196
Contents ix

11 Adding jQuery UI Elements 201


Adding the jQuery UI Library 201
Implementing an Autocomplete Input 203
Implementing Drag and Drop 205
Adding Datepicker Element 212
Using Sliders to Manipulate Elements 215
Creating a Menu 219
Adding Tooltips 223

12 Animation and Other Special Effects 227


Understanding jQuery Animation 228
Animating Visibility 234
Making an Element Slide Back to Disappear 238
Animating Show and Hide 242
Animating Resizing an Image 246
Animating Moving an Element 248

13 Using AJAX to Communicate with


Web Servers and Web Services 251
Understanding AJAX 251
AJAX from JavaScript 261
AJAX from jQuery 267
Handling jQuery AJAX Responses 282
Using Advanced jQuery AJAX 285

14 Implementing Mobile Web Sites with


jQuery 291
Getting Started with jQuery Mobile 291
Building Mobile Pages 302
Implementing Mobile Sites with Multiple
Pages 306
Creating a Navbar 314
Applying a Grid Layout 316
Implementing Listviews 320
x Contents

Using Collapsible Blocks and Sets 326


Adding Auxiliary Content to Panels 327
Working with Popups 329
Building Mobile-Friendly Tables 332
Creating Mobile Forms 334

Index 341
Acknowledgments
I’d like to take this page to thank all those who made
this title possible. First, I thank my wonderful wife and
boys for giving me the inspiration and support I need.
I’d never make it far without you.Thanks to Mark
Taber for getting this title rolling in the right direc-
tion; Karen Gill for turning the ramblings of my techie
mind into coherent text; Phil Ballard for ensuring the
accuracy in the book and keeping me honest; Kathy
Ruiz and Gloria Schurick for making sure the book is
the highest quality; Larry Sweazy for making sure that
the readers can actually find what they look for in the
book;Tammy Graham and Laura Robbins for their
graphical genius; Chuti Prasertsith for the stylish and
sleek cover; and Katherine Matejka for all her hard
work in making sure this book is the best it can be.
You guys are awesome!
About the Author
Brad Dayley is a senior software engineer with 20
years of experience developing enterprise applications.
He has used HTML/CSS, JavaScript, and jQuery
extensively to develop a wide array of web pages rang-
ing from enterprise application interfaces to sophisti-
cated rich Internet applications to smart interfaces for
mobile web services. He is the author of Python
Developer’s Phrasebook and Sams Teach Yourself jQuery and
JavaScript in 24 Hours.
We Want to Hear from You!
As the reader of this book, you are our most important
critic and commentator.We value your opinion and
want to know what we’re doing right, what we could
do better, what areas you’d like to see us publish in,
and any other words of wisdom you’re willing to pass
our way.
You can email or write directly to let us know what
you did or didn’t like about this book—as well as what
we can do to make our books stronger.
Please note that we cannot help you with technical problems
related to the topic of this book, and that due to the high vol-
ume of mail we receive, we might not be able to reply to every
message.
When you write, please be sure to include this book’s
title and author as well as your name and contact
information.
Email: [email protected]
Mail: Reader Feedback
Addison-Wesley Developer’s Library
800 East 96th Street
Indianapolis, IN 46240 USA

Reader Services
Visit our Web site and register this book at
informit.com/register for convenient access to any
updates, downloads, or errata that might be available
for this book.
This page intentionally left blank
Random documents with unrelated
content Scribd suggests to you:
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookball.com

You might also like