Book Image

jQuery Mobile Web Development Essentials - Third Edition

By : Raymond Camden, Andy Matthews
Book Image

jQuery Mobile Web Development Essentials - Third Edition

By: Raymond Camden, Andy Matthews

Overview of this book

jQuery Mobile is a HTML5-based touch-optimized web framework. jQuery Mobile can be used to build responsive cross-platform websites and apps for a wide range of smartphones, tablets, and desktop devices. The jQuery Mobile framework can be integrated with other mobile app frameworks such as PhoneGap, IBM Worklight, and more. Introduction to jQuery Mobile explains how to add the framework to your HTML pages to create rich, mobile-optimized web pages with minimal effort. You’ll learn how to use jQuery Mobile’s automatic enhancements and configure the framework for customized, powerful mobile-friendly websites. We then dig into forms, events, and styling. You'll see how jQuery Mobile automatically enhances content, and will find out how to use the JavaScript API to build complex sites. We’ll introduce you to how jQuery Mobile can be themed as well looking into how JavaScript can be used for deep sets of customizations. The examples are ready to run and can be used to help kick-start your own site. Along the way, you will leverage all the concepts you learn to build three sample mobile applications.
Table of Contents (20 chapters)
jQuery Mobile Web Development Essentials Third Edition
About the Authors
About the Reviewer

Using filterable widgets

The next widget we'll look at is the filterable widget. This is a generic concept of a widget that provides a way to automatically filter the data inside it. Imagine a large list. By allowing the user to filter, they can quickly focus on the content they are trying to find.

The general process for creating filterable content involves a few steps. You can begin by adding a form field that lets the user enter text. In theory, any content that throws a change event can be used, but in most cases, you'll want to use a simple text field. Next, you need to add data-filter="true" to the parent element whose children will be filtered. In the same element, you also need to provide data-input with a value that points to the jQuery selector of the text field you set up first. In general, this is the process. Let's consider a simple example:

Listing 7-9: test_filter.html
<div role="main" class="ui-content">

   <input type="text" id="myFilter"