--- title: GlobalEventHandlers.ontouchend slug: Web/API/GlobalEventHandlers/ontouchend tags: - API - Experimental - HTML DOM - Reference - TouchEvent translation_of: Web/API/GlobalEventHandlers/ontouchend ---
ontouchstart は {{domxref("GlobalEventHandlers")}} ミックスインのプロパティで、 {{event("touchstart")}} イベントを処理する {{event("Event_handlers", "event handler")}} です。
注: このプロパティは公式には標準化されていません。これは {{SpecName('Touch Events 2')}} {{Spec2('Touch Events 2')}} 仕様書で定義されているものであり、 {{SpecName('Touch Events')}} {{Spec2('Touch Events')}} では定義されていません。このプロパティは広く実装されているわけではありません。
var endHandler = targetElement.ontouchend;
endHandlertargetElement の touchend イベントハンドラー。この例では、ontouchend を使用して要素の touchend イベントを処理する2つの方法を示します。
<html>
<script>
function endTouch(ev) {
// イベントの処理
}
function init() {
let el = document.getElementById('target1');
el.ontouchend = endTouch;
}
</script>
<body onload="init();">
<div id="target1"> Touch me ... </div>
<div id="target2" ontouchend="endTouch(event)"> Touch me ... </div>
</body>
</html>
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName('Touch Events 2','#dom-globaleventhandlers-ontouchend')}} | {{Spec2('Touch Events 2')}} | 非安定版 |
{{Compat("api.GlobalEventHandlers.ontouchend")}}