Disabling text selection using jquery - Javascript jQuery

Javascript examples for jQuery:Selector

Description

Disabling text selection using jquery

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.7.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){//from   ww w.  j  a va  2  s .  c  om
$("#123").bind("selectstart", function (evt) {
    evt.preventDefault();
});
    });

      </script> 
   </head> 
   <body> 
      <input id="123" value="Select this text, if you can">  
   </body>
</html>

Related Tutorials