Book Image

jQuery Mobile First Look

Book Image

jQuery Mobile First Look

Overview of this book

Table of Contents (17 chapters)
jQuery Mobile First Look
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Handling events


You can still use any jQuery event you might need, but chances are you are looking forward to providing a better user experience to mobile users.

In order to enhance the performance of mobile-browsing, jQuery Mobile adds a new set of events which are mobile-specific and are based upon native events.

The custom set of events behaves no differently as any other jQuery event would, and can be bound to them with either bind() or live().

Tip

Bind or live?

Both events are used for a similar purpose, which is attaching a handler to an event for the elements which match the current selector. The only difference is that live() attaches the handler to the elements matching the current selector that will be created in the future.

This is to say, for example, that if we want a click event to be bound to the already existing paragraphs only, we should use bind().

On the other hand, if we plan on adding a new paragraph, and we need the click event handler attached to it, too, we need to use...