How to disable selection of text on a web page

Disable selection of every element with CSS

body {
  -webkit-user-select: none;
     -moz-user-select: -moz-none;
      -ms-user-select: none;
          user-select: none;
}

This is supported by Chrome, Safari, Firefox, IE 10, and iOS Devices. More info on MDN page.

Edit: If you want <input> and <textarea> to remain selectable in Firefox, add:

input,
textarea {
     -moz-user-select: text;
}

Disable context menu with jQuery

$(document).on("contextmenu", function (event) { event.preventDefault(); });

use this code https://www.docsity.com/it/teorie-e-pratiche-del-web-4/556038/

body, html{     
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;  
}