Prevents texts being selectable in Jquery

So in some situations it is needed to prevent user from selecting text in web page.

So it will play nice in some situations like drag and drop.

So it can be done using Jquery.


$('p').attr('unselectable', 'on')
.css('user-select', 'none')
.on('selectstart', false);

Code pen