@threehymnsFeb 13.2023 — #The best way to do this would be to use the user-select: none property. You could also apply this to only a single element or set of elements.
@JaySODec 05.2022 — #There are a few ways to prevent text selection highlighting. One way is to use the user-select property in CSS and set it to none. This will prevent users from being able to select text on the page.
* { user-select: none; }
Another way to prevent text selection highlighting is to use the onselectstart event in JavaScript and prevent the default behavior when this event is triggered. This will also prevent users from being able to select text on the page.
For example, you could use the following JavaScript to prevent text selection highlighting on a page:
Note that using these methods will prevent users from being able to select text on the page, which may not be desired in all cases. It is important to consider the user experience before using these methods to prevent text selection highlighting.