Skip to Main Content
jQuery Cookbook
book

jQuery Cookbook

by Cody Lindley
November 2009
Intermediate to advanced content levelIntermediate to advanced
480 pages
11h 50m
English
O'Reilly Media, Inc.
Content preview from jQuery Cookbook

Chapter 10. HTML Form Enhancements from Scratch

Brian Cherne

Introduction

Whether you’re trying to learn more about JavaScript and jQuery or you just want to code the most direct solution for your immediate problem, sometimes writing code from scratch is the best approach. This chapter aims to provide you with simple, generic solutions that will help you get started writing your own code.

It is important to note that while there are great benefits to starting from scratch, some of the more common problems you’ll encounter, such as remaining character count, autoresizing textareas, and form validation (just to name a few), have already been addressed by others. Please see Chapter 11 or visit the jQuery forums and blogs online for more information on how community-critiqued and community-tested plugins can help you. Sometimes it helps to look at someone else’s code to find out what you could do better with yours.

When necessary, I provide some sample HTML under the “Problem” heading of each recipe. This isn’t a philosophical statement—there isn’t anything wrong or problematic with naked HTML. I am, however, trying to reinforce the mind-set that JavaScript should be used for enhancing existing HTML and improving user interaction. JavaScript is, and should be considered, completely separate from your HTML.

Note

In the following recipes I am only showing XHTML code snippets relevant to the problem. Please make sure that your code is a complete XHTML document and that it passes validation. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

jQuery UI in Action

jQuery UI in Action

TJ VanToll
Head First jQuery

Head First jQuery

Ryan Benedetti, Ronan Cranley

Publisher Resources

ISBN: 9780596806941Supplemental ContentErrata Page