Page-Details : Disable Text Selection | JavaScriptSource

Page-Details : Disable Text Selection

James Nisbet Feb 10, 2006
Use this script to disable the selection of text on a page. It's very simple using two of the built-in JavaScript events to cancel the selection before it starts. You can even attach the events to a specific element.
[This section of text cannot be selected.] Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

The JavaScript Source: Page-Details : Disable Text Selection

Simply click inside the window below, use your cursor to highlight the script, and copy [Control]+C the script into a new file in your text editor (such as Note Pad) and save [Control+S]. The script is yours!!!

Did you use this script?  Do you like this site?  Please link to us!

Leave a Response

1 comment)

I found and used a Disable Text Selection script at another site, but lost it. I was able to use Google (search string="disable text selection + javascript" to find your version. Still have to test it with Opera and Safari. Thanks, you saved me time and effort.[br /][br /]PS. The "Hear it!" link below is a nice twist.

Chuck Vaughnn Nov 26, 2008