Book Image

jQuery Essentials

By : Troy Miles
Book Image

jQuery Essentials

By: Troy Miles

Overview of this book

<p>JQuery is still the most popular JavaScript library. It is used in over 60% of the top websites on the Internet. It was written to make DOM manipulation (so, moving things around a web page) easier for developers. It acts through JavaScript to ascribe HTML elements to the DOM attributes. Because it is a library of predefined functions, all you need to start using jQuery is a working knowledge of the syntax and a reference for the functions available to you.</p> <p>This practical guide shows you how to make the most of jQuery to boost the performance of your websites and applications. We start off with a quick glance through the basics of JQuery, followed by the explanation of JQuery selectors, filters, and DOM element manipulation. After this, you will learn how events and animations can be used to create and design beautiful and user-friendly sites. Next, you will be familiarized with Ajax functions to help you send and receive data from your server. Finally, we’ll walk you through using built-in plugins and eventually create your own plugins for your websites.</p> <p>By the end of this book, you will be able to to build robust and efficient websites successfully using JQuery.</p>
Table of Contents (17 chapters)
jQuery Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Event shorthand methods


Web programming is event-driven, and some events are used so often that jQuery has created shorthand methods to hook them. The following two methods are equal:

$(element).on('click', handling function);
$(element).click(handling function);

The second form is shorter and possibly easier to read, but there is a downside. In the shorthand form, there is no way to add the extra and optional parameters. If you need the selector or data parameters, then you must use the longhand form. Here is a list of all of the shorthand methods:

.change();
.click();
.dblclick();
.error();
.focus();
.focusin();
.focusout();
.hover();
.keydown();
.keypress();
.keyup();
.load();
.mousedown();
.mouseenter();
.mouseleave();
.mousemove();
.mouseout();
.mouseover();
.resize();
.scroll();
.select();
.submit();