Copy Paste Prevention - "Form" style text entry questions | XM Community
Solved

Copy Paste Prevention - "Form" style text entry questions

  • 28 September 2018
  • 2 replies
  • 193 views

I am trying to prevent people from pasting into a a from-style text entry question in a survey I am creating. I have a code that prevents Copy/Paste into a typical text box (works for "single line", "multi line", "essay text box," and "password" text entries); but, it does not work with "form" text entry boxes. Does anybody have an effective copy/paste Javascript that works with form-style questions?
icon

Best answer by TomG 28 September 2018, 22:22

View original

2 replies

Userlevel 7
Badge +27
This should work on any type of text inputs in a question:
```
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" textarea,input[type=text]").on("paste", function(e) { e.preventDefault(); });
});
```
This is perfect! Thank you!

Leave a Reply