Book Image

Learning jQuery : Better Interaction Design and Web Development with Simple JavaScript Techniques

Book Image

Learning jQuery : Better Interaction Design and Web Development with Simple JavaScript Techniques

Overview of this book

Table of Contents (18 chapters)
Learning jQuery
Credits
About the Authors
About the Reviewers
Preface

AJAX Auto-Completion


We can further spruce up our search field by offering auto-completion of its contents. This feature will allow users to type the beginning of a search term and see all of the possible terms that begin with the typed string. Since the list of terms can be drawn from a database that is driving the site, the user can know that search results are forthcoming if the typed term is used. Also, if the database provides the terms in order of popularity or number of results, the user can be guided to more appropriate searches.

Auto-completion is a very complicated subject, with subtleties introduced by different kinds of user interaction. We will craft a working example here, but cannot in this space explore all of the advanced concepts such as limiting the rate of requests or multi-term completion. The auto-complete plug-in for jQuery is recommended for simple, real-world implementations, and as a starting point for more complex ones. More information on plug-ins can be found...