Skip to content
Advertisement

How to Disable onclick text highlight in mobile browser (Chrome)?

I’m using Boostrap 4 to build a Web. A simple code such as below:

JavaScript

I use my Android Chrome Browser(version 80.0.3987.149) click on the text, it will highlighted the text and popup google search.

enter image description here

How can i disable it? I Don’t want to set user-select: none because I need to let the user highlight the text when long press.

Advertisement

Answer

JavaScript

Source1: https://www.w3schools.com/cssref/css3_pr_user-select.asp
Source2: https://developer.mozilla.org/en-US/docs/Web/CSS/user-select

version compatibility

desktop:

JavaScript

mobile

JavaScript

refer to the sources for more info and version compatibility.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement