Ask your Question

PEOPLE YOU MIGHT KNOW

Fitness
Fitness

Be healthy and stay in shape

Mohali,  India
Everest Links
Everest Links

Everest Links Management Consultants

Dubai,  United Arab Emirates
Varun
Varun

Business Owner

Gurugram,  India
Sithu
Sithu

Web Developer

Chennai,  India
Ashish
Ashish

CO-FOUNDER

Hayward,  United States

Write to us

Ask Question

Preventing ghost click when binding touchstart and click(Ghost clicks in mobile browsers)

What is ghost Clicking?
In any touch device, mobile browsers emulate click events when the screen is touched.

 

What happend when the screen is taped?

A touchstart event is fired as soon as a finger touches the screen.A touchend event is fired as soon as the finger leaves the screen, then the browser waits around 300ms for another tap.If not, a click event is fired. This is the ghost click.

 

How to Prevent this?

$('#div').on('touchstart', function(e) {
    alert('touch');
    e.preventDefault();
});

0   0
Shailesh Kumar

Please rotate your device

We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site