The jQueryMobile library enables us to hook up with various types of events. The touch events is one of them. The following code sample shows how to do it in order to handle the taphold event.

<!DOCTYPE html>
    <title>My Cycling</title>
    <link rel="stylesheet"
          href="" />
    <script src=""></script>
    <script src="">
<div data-role="page" id="home" data-theme="e">
    <div data-role="header">
        <h1>Sample Demo</h1>
    <div data-role="content" data-theme="e">

      <div class="taphold">
          <h1>la la la</h1>
      <div class="taphold">
          <h1>ga ga ga</h1>

    <div data-role="footer">

<script type="text/javascript">
        $(".taphold").bind("taphold", function(event) {
            $(this).html("<h1>was tapped</h1>");


The following video clip overviews the execution of this code sample and explains it.

You can find more free video clips, tutorials, slides and code samples for learning how to use the jQueryMobile library at

Leave a Reply

Your email address will not be published. Required fields are marked *