Prevent Respondents from Selecting Text

In some circumstances, users do not want their respondents to be able to select text. This tutorial provides some JavaScript to help prevent that.

Check it out in an example survey!

OR

Add a survey with the setup to your account!

Setup

  1. On the page that you'd like to prevent respondents from selecting text go to Add Action > JavaScript.
  2. Give your action a Description.
  3. Paste the below code into your new JavaScript Action and Save Action.

function disableSelection(target){

    if (typeof target.onselectstart!="undefined") //IE route
        target.onselectstart=function(){return false}

    else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
        target.style.MozUserSelect="none"

    else //All other route (ie: Opera)
        target.onmousedown=function(){return false}

    target.style.cursor = "default"
}

disableSelection(document.body) 

Time to Test!

Go to your live link or preview and try to select some text in your survey. This should now be disabled. 

Scripting and Other Custom Solutions

We’re always happy to help you debug any documented script that is used as is. That said, we do not have the resources to write scripts on demand or to debug a customized script.

If you have customization ideas that you haven't figured out how to tackle, we're happy to be a sounding board for Alchemer features and functionality ideas that might meet your needs. Beyond this, check out our Professional Services; these folks have the scripting chops to help you to achieve what you are looking for!

Basic Standard Market Research HR Professional Full Access Reporting
Free Individual Team & Enterprise
Feature Included In