Disable content selection on web page using jquery

In previous article we learned how to prevent our blog content from copying by disabling right click on web page. Now in this article i will show you how to disable content selection on web page using jQuery.

To  disable content selection on web page follow these steps

Include jQuery in your web page

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

Insert following code in head section

$(function(){
$(document).attr('unselectable','on')
.css({'-moz-user-select':'-moz-none',
'-moz-user-select':'none',
'-o-user-select':'none',
'-khtml-user-select':'none',
'-webkit-user-select':'none',
'-ms-user-select':'none',
'user-select':'none'
}).on('selectstart', function(){return false; });
});

Demo


Liked It? Get Free updates in your Email

Delivered by feedburner

One thought on “Disable content selection on web page using jquery

  1. Pingback: Disable right click on web page using jquery | Web Tools

Leave a Reply

Your email address will not be published. Required fields are marked *