Sunday, 2019-03-24, 8:07 AM
Welcome Guest | RSS
Farhan Khalid
Main | Disable Text Selection script - Forum | Registration | Login
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » Education Club » Javascript » Disable Text Selection script
Disable Text Selection script
Messages: 288
Group: Administrators
Title: Admin
Reputation: 0
Status: Offline

Awards: 1Loading awards ...
10:05 PM

Message # 1
Disable Text Selection script

Author: Dynamic Drive

Note: Script rewritten Dec 28th, 06.

Description: This is a simple script that lets you disable text selection (the ability to drag and select text) within any element on your page, such as a certain paragraph. Script works in IE, Firefox, and Opera.

Demo: Try selecting text within the above paragraph- it's disabled.

Directions: Add this script to the HEAD section of your page:
Available for users only

With the script installed, just call the function disableSelection(target) at the very end of the document with a reference to the element you wish to disable text within. A few examples:
Available for users only

Make sure to call the above functions at the end of the document to ensure the element in which to disable text for is defined before the function is called. :new:[code]

This user has not applied a signature yet.
HTML code to this post
BB-code to this post
Direct link to this post

Message edited by farhan411 - Friday, 2009-05-08, 10:10 PM
Forum » Education Club » Javascript » Disable Text Selection script
  • Page 1 of 1
  • 1

Copyright MyCorp © 2019

Hosted by uCoz