jQuery Selectors - Aurelio De Rosa - E-Book

jQuery Selectors E-Book

Aurelio De Rosa

0,0
19,19 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

jQuery's selectors is one of the most important concepts of the jQuery library. Usually, the first thing you do is to select one or more elements of a page in order to manipulate them. Therefore, to efficiently learn the usage of jQuery's selectors is one of the first steps to successfully build your website.

Instant jQuery Selectors is a practical guide that will teach you how to use jQuery's selectors efficiently in order to easily select theelements of your pages to operate upon with jQuery's methods. You will go through the most common problems that you could face while developing your project and will learn how to solve them with the help of focused examples that Instant jQuery Selectors has to offer.

Instant jQuery Selectors, starting from how to set up jQuery and how to choose the right version for your project, explains to you all the selectors available using a multitude of simple and practical recipes that will help you start using selectors in the right way. Reading the presented recipes you'll learn about the numerous selectors and filters of jQuery – almost 100 of them! You will see how to reuse collections, the methods to filter collections, and how to take advantage of the lesser known parameter of jQuery's constructor: context. Also, you'll discover the methods to traverse the DOM and the techniques to improve the performance of your website by just tweaking selectors.

Instant jQuery Selectors is the resource to learn everything you need to know about jQuery's selectors.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 81

Veröffentlichungsjahr: 2013

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Instant JQuery Selectors
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Instant jQuery Selectors
Setting up jQuery (Must know)
Getting ready
How to do it...
There's more...
What version to use?
Compressed or not?
Using a CDN
The All selector (Must know)
How to do it...
How it works...
There's more...
Alternatives to $(document).ready()
Avoiding $(document).ready()
css() and browsers support
Selectors and browsers support
Performance
Selecting by ID (Must know)
How to do it...
How it works...
There's more...
Escaping special characters
Storing a collection
Selecting by class (Must know)
How to do it...
How it works...
There's more...
getElementsByClassName()
Selecting elements having two or more classes
Selecting by tag (Must know)
How to do it...
How it works...
There's more...
Selecting and using tag names with classes and IDs
getElementsByTagName()
Multiple selectors at once (Should know)
How to do it...
How it works...
Selecting by hierarchy (Must know)
Getting ready
How to do it...
How it works...
Selecting by attributes (Should know)
Getting ready
How to do it...
How it works...
There's more...
Multiple attribute selector
Not equal selector
Using filter() and attr()
Selecting by position using filters (Should know)
Getting ready
How to do it...
How it works...
Selecting from elements using filters (Should know)
Getting ready
How to do it...
How it works...
Child filters (Should know)
Getting ready
How to do it...
How it works...
Other filters (Become an expert)
Getting ready
How to do it...
How it works...
Custom filters (Become an expert)
How to do it...
How it works...
Context matters (Should know)
How to do it...
How it works...
There's more...
Improving performance re-using selected elements (Become an expert)
How to do it...
How it works...
Methods to filter collections (Become an expert)
Getting ready
How to do it...
How it works...
Traversing DOM SubTrees (Become an expert)
Getting ready
How to do it...
How to do it...
How to have efficient selectors (Become an expert)
How to do it...

Instant jQuery Selectors

Instant JQuery Selectors

Copyright © 2013 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: August 2013

Production Reference: 1230813

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78328-221-0

www.packtpub.com

Credits

Author

Aurelio De Rosa

Reviewers

Kent C. Dodds

Acquisition Editor

Nikhil Karkal

Mary Jasmine Nadar

Commissioning Editor

Nikhil Chinnari

Technical Editor

Dipika Gaonkar

Project Coordinator

Esha Thakker

Proofreader

Joel T. Johnson

Production Coordinator

Adonia Jones

Cover Work

Adonia Jones

Cover Image

Abhinash Sahu

About the Author

Aurelio De Rosa is an Italian web and application developer with more than five years' experience in programming for web using HTML5, CSS3, JavaScript, and PHP. He mainly uses the LAMP stack and frameworks, such as jQuery, jQuery Mobile, and Cordova (PhoneGap). His interests also include web security, web accessibility, SEO, and WordPress.

He is currently self-employed working with the cited technologies and is also a regular blogger for several networks (SitePoint, Tuts+, and FlippinAwesome), where he writes articles about the topics he usually works with and more.

You can find more about him at his website http://www.audero.it.

First of all, I'd like to thank my parents, Raffaele and Eufemia, because they gave me chance to study and follow this path that I've chosen, and for this I owe them. With all your sacrifices, you allowed me to have everything a person may need in his life. I also want to thank Annarita for teaching me the true meaning of the word "love". With you my life is full of moments of joy and I hope we'll be together for the rest of our lives. I want to thank Francesco for always being there in the time of need and proving to me that lifetime friendship can really exist.

About the Reviewer

Kent C. Dodds is a young and upcoming front end developer. Kent is currently pursuing his Masters in Information Systems Management degree from Brigham Young University in Provo, Utah. Kent anticipates staying on with Domo Technologies Incorporated upon his graduation as an AngularJS front-end developer. Domo Technologies is a start up making huge waves in the Business Intelligence world and Kent looks forward to helping make that wave grow bigger.

Kent was born and raised in Twin Falls, Idaho as the eleventh child of twelve and has always loved spending time with family. Kent grew up loving being productive with computers and his interests have only grown with time.

Kent loves to contribute to the online community and hopes that his StackOverflow, GitHub, and Google+ accounts will provide himself and others opportunities to discover new technologies to improve themselves professionally.

In his spare time, Kent enjoys spending time with his beautiful wife Brooke and their daughter Becca. They are expecting another addition to their little family in December 2013, and on the day of writing this, Kent and Brooke celebrated their second anniversary. Of course, Kent would like to thank Brooke and Becca without whom he would be a lot less happy and a less satisfied person. Kent also enjoys investigating new technologies and building new things to always keep learning.

Feel free to connect with Kent online at http://kent.doddsfamily.us.

www.PacktPub.com

Support files, eBooks, discount offers and more

You might want to visit www.PacktPub.com for support files and downloads related to your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print and bookmark contentOn demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

In loving memory of my grandmother, Giuseppina.

Preface

jQuery is a popular JavaScript library designed to simplify the client-side scripting of HTML, widely used by most of the websites on the Internet. It helps you to manipulate elements, and create fancy interactive websites in a very easy way that is compatible with modern and older browsers as well.

Instant jQuery Selectors will take you as a beginner and turn you into an expert that knows all of the tips and tricks of the pros about the jQuery's basic element: selectors. Through the use of examples, you'll be able to start using selectors efficiently and easily to solve your day-to-day problems.

What this book covers

Setting up jQuery (Must know) explains how to download and include jQuery in a web page and a good rule of thumb to choose between the two major jQuery branches, 1.X and 2.X.

The All selector (Must know) covers the All (or Universal) selector, to select all of the elements of a document.

Selecting by ID (Must know) introduces the ID selector and how jQuery manages it behind the scenes.

Selecting by class (Must know) describes the Class selector and how to optimize it for older browsers.

Selecting by tag (Must know) demonstrates the use of the Element selector and how you can use it in conjunction with other selectors.

Multiple selectors at once (Should know) shows how to use more than one selector in a single call.

Selecting by hierarchy (Must know) covers the hierarchy operators that allow you to retrieve elements by their relationship in the DOM.

Selecting by attributes (Should know) describes how many and what are the selectors to collect elements by their attributes.

Selecting by position using filters (Should know) introduces filters, and in particular those that allow to filter a collection using the elements' positions inside the collection itself.

Selecting from elements using filters (Should know) covers filters specific to form elements.

Child filters (Should know) describes filters to target node's children.

Other filters (Become an expert) shows the filters not covered in the previous recipes.

Custom filters (Become an expert) explains how to create a custom filter using two approaches.

Context matters (Should know) shows how to use the second parameter of the jQuery constructor in order to improve performance.