Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • jQuery Mobile Touch Events

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 375
    Comment on it

    An event is something which triggers when something happens.In jquery we have gone through many of them. In this particular blog we explain about the Touch event. The touch event is triggered when the user taps on an element.

    In the following example, we will hide the <p> element whenever the user taps on a <p> element;

    <!DOCTYPE html>
    <html>
    <head>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
    <script>
    $(document).on("pagecreate","#pageone",function(){
      $("p").on("tap",function(){
        $(this).hide();
      });
    });
    </script>
    </head>
    <body>
    
    <div data-role="page" id="pageone">
    
      <div>
        <p> Tap on me</p>
        <p>Touch me also</p>
      </div>
    
    
    </div>
    
    </body>
    </html>

    Execute the above code, you will see two <p> elements with some text written, and once you tap on it , the element will disappear.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: