How to disable contextmenu in chrome while on a touch screen. This pops up on selection/on long tap of any text. Is there any solution which we can manage using css or javascript.
1 Answer
you can try to add a listener, that catchs every touch on a section
document.getElementById('yoursection').addEventListener('touchstart', (event) => {
event.preventDefault();
})
but note, that in that section nothing more can be touched ...
-
Thanks Christian for quick reply.. But on select I want to show my custom menu.. Can you please suggest is there an way to do it same.. Aug 30, 2017 at 7:39
-
you can just add the function that shows you menu to the anonymus function (so before or after
event.preventDefault()
) Aug 30, 2017 at 7:43