How to disable copy and paste on half a page of a survey, but enable for the rest of the page? | XM Community
Skip to main content

Hi there. I'm trying to disable copy and paste on my one section of my descriptive text in my survey, but enable it in another. In other words, I have two questions (both simple descriptive texts) in one block, I want one to disable copy/paste, and another to enable.
I've inserted the following code to disable copy/paste (which worked); however, it disabled copy/paste for the entire page (which is not what I wanted):

  



Any help would be much appreciated .

Remove all this CSS and just add the following code to the JS of the question on which you want to disable copy/paste:
Qualtrics.SurveyEngine.addOnReady(function(){
el = document.querySelector("#QR\\\\~"+this.questionId);
el.onpaste = function(){return false};
el.oncopy = function(){return false};
el.oncut = function(){return false};
});


Thank you Ahmed. Unfortunately the code didn't seem to work - I'm still able to select the text.


but can you copy it?


Yes it still copies


Please take a look at this demo. You can choose the relevant code that you want.


Leave a Reply