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

How to disable copy and paste on half a page of a survey, but enable for the rest of the page?


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 .

5 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • January 7, 2021

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};
});


  • Author
  • January 7, 2021

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


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • January 7, 2021

but can you copy it?


  • Author
  • January 7, 2021

Yes it still copies


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • January 7, 2021

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