Book Image

Mastering jQuery

By : Alex Libby
Book Image

Mastering jQuery

By: Alex Libby

Overview of this book

<p>Mastering jQuery has been written not only to help maximize your skills with core functionality in the library, but also to explore some of the more intriguing ways of using the library to achieve real-world solutions that could feature on any website or online environment.</p> <p>You'll start with a look at some of the more advanced ways to incorporate the library into your pages, followed by working with forms and advanced form validation using regular expressions. Next you'll move on to animating in jQuery, advanced event handling, and using jQuery effects.</p> <p>Finally, you will develop practical examples of using jQuery with external functionality such as node-webkit, before finishing with a session on optimizing your version of the library for maximum efficiency and exploring best practices for using QUnit.</p>
Table of Contents (21 chapters)
Mastering jQuery
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exploring the need for form validation


There are different ways to improve the usability of a form, but validation is arguably one of the most important facets that we should consider. How many times have you visited a site and filled in your details only to be told that there is a problem? Sounds familiar, right?

Validating a form is key to maintaining the consistency of information; the form will process the information that has been entered in order to ensure that it is correct. Take an example of the following scenarios:

  • If an e-mail address is entered, let's make sure it has a valid format. The e-mail address should include a full stop and contain an @ symbol somewhere in the address.

  • Calling someone? What country are they in? Let's make sure that the phone number follows the right format, if we've already set the form to show a specific format of the fields for a chosen country.

I think you get the idea. Now, this might sound as if we're stating the obvious here (and no, I've not lost...