-1

Is there a feature in phone gap or maybe in jquery that will mean I can pick up any tap & Hold events on a element. I've looked into phonegap documentation but cannot find anything

I see jQuery mobile has it but I don't have this included at the moment and was hoping I didn't need to add another library for this

Thanks

Steve
  • 2,971
  • 7
  • 38
  • 63

1 Answers1

-1

Here you can do for same . I have tried in my project

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<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("taphold",function(){
    $(this).hide();
  });                       
});
</script>
</head>
<body>

<div data-role="page" id="pageone">
  <div data-role="header">
    <h1>The taphold Event</h1>
  </div>

  <div data-role="main" class="ui-content">
    <p>If you tap and hold me for one second, I will disappear.</p>
    <p>Tap and hold me!</p>
    <p>Tap and hold me too!</p>
  </div>

  <div data-role="footer">
    <h1>Footer Text</h1>
  </div>
</div> 

</body>
</html>

http://www.w3schools.com/jquerymobile/tryit.asp?filename=tryjqmob_event_taphold

bummi
  • 27,123
  • 14
  • 62
  • 101
  • 2
    A code block alone does not provide a good answer. Please add explanations (why it solve the issue, where was the mistake, etc...) – Louis Barranqueiro Jan 08 '16 at 12:33
  • Trying to get what you mean for "Here you can do for same". Please explain what you suggest with this block of code. – Alfabravo Jan 08 '16 at 15:26