Created
November 15, 2012 16:02
-
-
Save jpbyrne/4079390 to your computer and use it in GitHub Desktop.
This method is used to prevent the selection of HTML page elements.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function disableSelection(target){ | |
if (typeof target.onselectstart!="undefined") // if IE | |
target.onselectstart=function(){return false} | |
else if (typeof target.style.MozUserSelect!="undefined") // if Firefox | |
target.style.MozUserSelect="none"; | |
else // others | |
target.onmousedown=function(){return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment