JavaScript Element touchend Event

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
DOM event
Instance event

What You’ll Learn

The touchend event fires when one or more touch points are removed from the surface. Learn TouchEvent, changedTouches, how it differs from touchcancel, tap patterns, Pointer Events alternatives, and five try-it labs.

01

Kind

Instance event

02

Type

TouchEvent

03

When

Finger lifts

04

Handler

ontouchend

05

Bubbles?

Yes

06

Status

Limited availability

Introduction

touchend is the normal end of a touch: the user lifts one or more fingers. Use it to finish a drag, complete a tap, or clear “pressed” UI.

MDN reminds you that a gesture can end with touchcancel instead—always handle both if you track press/drag state. Browsers may also synthesize mouse / click events after touch, so avoid double actions.

💡
Beginner tip

For new cross-device UIs, prefer pointerup. Keep touchend when maintaining Touch Events code or touch-only flows.

Understanding touchend

An instance event that answers: “Did one or more fingers leave the surface?”

  • Trigger — touch points removed (normal lift).
  • Event typeTouchEvent; use changedTouches.
  • Bubbles — yes; cancelable behavior can vary by UA.
  • Remember — you may get touchcancel instead of touchend.
  • Limited availability on MDN (not Baseline)—desktop Safari often lacks Touch Events.

📝 Syntax

Use the event name with addEventListener, or set the handler property:

JavaScript
addEventListener("touchend", (event) => { });

ontouchend = (event) => { };

Event type

A TouchEvent (inherits from UIEvent / Event).

Handy TouchEvent properties

PropertyMeaning
changedTouchesTouch points that just changed (the ones that lifted)
touchesAll current contacts still on the surface
targetTouchesContacts that started on this target and are still down
altKey / ctrlKey / metaKey / shiftKeyModifier keys at event time

⚡ Quick Reference

GoalCode / note
Listenel.addEventListener("touchend", fn)
Handler propertyel.ontouchend = fn
Lifted pointsevent.changedTouches
Tap positionchangedTouches[0].clientX / clientY
Also handle abortElement touchcancel
MDN statusLimited availability (not Baseline)

🔍 At a Glance

Four facts to remember about touchend.

Event type
TouchEvent

changedTouches

Means
lifted

Normal end

Bubbles
true

Listen on el

Baseline
no

Limited availability

Examples Gallery

Patterns follow MDN Element: touchend event and the Touch events guide. Use a touch device or DevTools touch simulation; some labs include a button for desktop practice.

📚 Getting Started

Listen for lift and read the TouchEvent.

Example 1 — Log touchend

Print how many points lifted when the user releases.

JavaScript
const pad = document.getElementById("pad");
const out = document.getElementById("out");

pad.addEventListener("touchend", (event) => {
  out.textContent =
    "touchend · lifted=" + event.changedTouches.length;
});
Try It Yourself

How It Works

changedTouches lists the contacts that just ended—even if other fingers remain down.

Example 2 — ontouchend Property

Same idea using the handler property form.

JavaScript
const pad = document.getElementById("pad");
const out = document.getElementById("out");

pad.ontouchend = (event) => {
  out.textContent = "ontouchend fired";
};
Try It Yourself

How It Works

Prefer addEventListener when you need multiple listeners or easy removal.

📈 Tap, Pair & Detect

Read lift coordinates, pair with cancel, and feature-detect.

Example 3 — Tap Position from changedTouches

Log where the finger left the pad.

JavaScript
pad.addEventListener("touchend", (event) => {
  const t = event.changedTouches[0];
  if (!t) return;
  out.textContent =
    "lift at x=" + Math.round(t.clientX) +
    " y=" + Math.round(t.clientY);
});
Try It Yourself

How It Works

After lift, the ended point lives in changedTouches—not necessarily in touches (which may be empty).

Example 4 — Handle touchend + touchcancel

Clear a pressed style for both a normal lift and an abort.

JavaScript
const pad = document.getElementById("pad");
const out = document.getElementById("out");

function clearPress(reason) {
  pad.classList.remove("pressed");
  out.textContent = reason;
}

pad.addEventListener("touchstart", () => {
  pad.classList.add("pressed");
  out.textContent = "pressed…";
}, { passive: true });

pad.addEventListener("touchend", () => clearPress("touchend · released"));
pad.addEventListener("touchcancel", () => clearPress("touchcancel · aborted"));
Try It Yourself

How It Works

MDN: you can get touchcancel instead of touchend—pair them so UI never sticks.

Example 5 — Feature Detect + Pointer Fallback Note

Check Touch Events support; prefer Pointer Events when building new UIs.

JavaScript
const out = document.getElementById("out");
const hasTouch = "ontouchend" in window;

out.textContent = hasTouch
  ? "Touch Events available — listen for touchend"
  : "No Touch Events — use Pointer Events (pointerup)";

if (hasTouch) {
  document.getElementById("pad").addEventListener("touchend", () => {
    out.textContent = "touchend received";
  });
}
Try It Yourself

How It Works

Many desktop browsers hide Touch Events even with a touchscreen—feature-detect and plan a Pointer Events path.

🚀 Common Use Cases

  • Complete a tap or button press when the finger lifts.
  • End a drag / swipe and snap to the final position.
  • Clear pressed / active styles on release.
  • Read the last lift coordinates from changedTouches.
  • Migrate toward pointerup for mouse + pen + touch together.

🔧 How It Works

1

Touch starts

touchstart (and maybe touchmove) while the finger is down.

Active
2

Finger lifts

Contact leaves the surface (or touchcancel aborts instead).

Release
3

touchend fires

TouchEvent with changedTouches for lifted points.

Event
4

Finish the gesture

Complete tap/drag; watch for synthesized click if needed.

📝 Notes

  • MDN: Limited availability (not Baseline)—no Deprecated / Experimental / Non-standard banner.
  • You can receive touchcancel instead of touchend—handle both for press/drag UI.
  • Desktop Safari often lacks Touch Events; test on iOS Safari / Android browsers.
  • Prefer Pointer Events for new cross-device interaction code.
  • Related learning: touchcancel, pointerup, addEventListener(), JavaScript hub.

Limited Browser Availability

touchend is marked Limited availability on MDN (not Baseline). Logos use the shared browser-image-sprite.png sprite from this project. Touch Events are strong on mobile; many desktop browsers omit them—prefer Pointer Events for cross-device UIs.

Limited availability

Element touchend

Fires when touch points leave the surface. Chrome 22+, Firefox 52+, Edge 12+, Safari iOS yes; desktop Safari often no.

Partial Not Baseline
Google Chrome 22+ (touch-capable / mobile)
Supported
Mozilla Firefox 52+ (desktop re-enabled)
Supported
Apple Safari iOS yes · desktop often no
Partial
Microsoft Edge 12+
Supported
Opera Mobile / Chromium touch paths
Partial
Internet Explorer Not supported (use Pointer Events)
Unavailable
touchend Limited

Bottom line: Use touchend for normal lifts in Touch Events code. Pair with touchcancel, and prefer pointerup for mouse + pen + touch together.

Conclusion

touchend is the normal “finger up” signal in the Touch Events API. Read changedTouches, finish your gesture, also listen for touchcancel, and consider Pointer Events when you need the same idea across mouse, pen, and touch.

Continue with touchmove, touchcancel, pointerup, addEventListener(), or the JavaScript hub.

💡 Best Practices

✅ Do

  • Read lift data from changedTouches
  • Handle touchcancel alongside touchend
  • Test with DevTools touch simulation or a real phone
  • Prefer Pointer Events for new multi-input UIs
  • Watch for duplicate click after touch if you also handle mouse

❌ Don’t

  • Assume every gesture ends with touchend (cancel exists)
  • Look only in touches for the lifted point
  • Assume desktop Safari exposes Touch Events
  • Detect “mobile” only by checking for ontouchstart
  • Overwrite ontouchend if you need multiple listeners

Key Takeaways

Knowledge Unlocked

Five things to remember about touchend

Finger up—finish the gesture, and still prepare for cancel.

5
Core concepts
📄02

TouchEvent

changedTouches

API
03

vs cancel

lift ≠ abort

Compare
🎯04

Tap / drag

finish gesture

Pattern
👆05

Limited

prefer pointerup

Status

❓ Frequently Asked Questions

It fires when one or more touch points are removed from the touch surface—normally when the user lifts a finger. Remember you can get touchcancel instead if the touch is aborted.
No. MDN does not mark Element touchend as Deprecated, Experimental, or Non-standard. It has Limited availability (not Baseline), mainly because desktop Safari and some desktop browsers omit or limit Touch Events.
A TouchEvent. Use changedTouches for the touch points that just lifted; also inspect touches and targetTouches as needed.
touchend is a normal lift. touchcancel means the system or browser aborted the touch—do not treat cancel as a successful tap.
User agents may dispatch mouse and click events after touch interactions. Prefer Pointer Events (pointerup) for unified handling, or be careful not to double-fire actions.
For cross-device UIs (mouse, pen, and touch), MDN recommends Pointer Events. pointerup is the close cousin of touchend.
Did you know?

After touchend, many browsers still fire mouse events and a click for compatibility. If you handle both touch and click, guard against running the same action twice.

Next: touchmove

Track continuous finger movement with Touch Events.

touchmove →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful