How to disable text selection on your website

Victor Mochere
1 Min Read

Disabling text selection on your website is a simple way to prevent your site visitors (internet users and competitors) from copying your web content. Once text selection is disabled, your website visitors will no longer be able to select characters on your website with their mouse. To do so, just follow the two simple steps below.

1. First copy and paste the script below before the </head> tag of your webpage or at the bottom of your header.php template file on WordPress.

<script type=”text/javascript”>

* Disable Text Selection

function disableSelection(target) {
if (typeof target.onselectstart!=”undefined”)
 target.onselectstart=function(){return false}
else if (typeof!=”undefined”)”none”
 target.onmousedown=function(){return false} = “default”


2. Next, copy and paste the script below before </body> the tag on the webpage you wish to disable text selection on. If you are using WordPress you can add this snippet to your header.php file in order to disable text selection on all webpages of your website. You can even add the script below to individual pages, posts, and template files like category.php to simply remove text selection from single webpages.

<script type=”text/javascript”>


Share This Article
Victor Mochere is a blogger, social media influencer, and netpreneur creating and marketing digital content.
1 Comment