We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

Our volunteers haven't translated this article into Bahasa Indonesia yet. Join us and help get the job done!
You can also read the article in English (US).

A global event handler for the touchstart event.

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Note: This attribute has not been formally standardized. It is specified in the Touch Events – Level 2 Editor's Draft specification and not in Touch Events Recommendation. This attribute is not widely implemented.


var startHandler = someElement.ontouchstart;

Return value

The touchstart event handler for element someElement.


This example shows two ways to use ontouchstart to set an element's touchstart event handler.

function startTouch(ev) {
 // Process the event
function init() {
 var el=document.getElementById("target1");
 el.ontouchstart = startTouch;
<body onload="init();">
<div id="target1"> Touch me ... </div>
<div id="target2" ontouchstart="startTouch(event)"> Touch me ... </div>


Specification Status Comment
Touch Events – Level 2 Editor's Draft Non-stable version.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 18.0 ? ? ? ?
Feature Android Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support ? (Yes) (Yes) ? ? ? ? ?

See also

Tag Dokumen dan Kontributor

 Kontributor untuk laman ini: jpmedley, rolfedh, AFBarstow
 Terakhir diperbarui oleh: jpmedley,