Latest web development tutorials
 

jQuery taphold Event

< jQuery Mobile Events

Example

Tap on a <p> element, and hold for one second, to hide it:

$("p").on("taphold",function(){
  $(this).hide();
});
Try it Yourself »

Definition and Usage

The taphold event is triggered when the user taps on an element and hold for one second.


Syntax

$("selector").on("taphold",function(event){...})

Parameter Description
function(event) Required. Specifies the function to run when the taphold event occurs.

The function has an optional event object, which can contain any jQuery event properties (e.g. event.target, event.type, etc.) See jQuery Events Reference for more information.

Try it Yourself - Examples

The event object
Using the event.target property to return which DOM element that triggered the taphold event.


< jQuery Mobile Events