You send an anonymous function to addEventListener. Instead, use a named function and send it removeEventListener, for example:
function handleTouchMove(e) { e.preventDefault(); } document.addEventListener('touchmove', handleTouchMove, false); document.removeEventListener('touchmove', handleTouchMove);
Otherwise, as you did, the function you sent removeEventListener was a completely different function, although it contained the same content.
source share