Try this in addOnload() function.
jQuery('Input:textbox').on("cut copy paste",function(e) {
e.preventDefault();
});
You can replace Input:textbox with OE box #id if it will not work.
Thanks so much @ArunDubey, unfortunately it’s still not working for me but I really appreciate the help!
Thanks so much @ArunDubey, unfortunately it’s still not working for me but I really appreciate the help!
jQuery('textarea').on("cut copy paste",function(e) {
e.preventDefault();
jQuery(".ValidationError").eq(0).text("Please enter the value, you are not allowed to paste value here.").addClass("error-msg").show();
});
It should work. anyways I have updated the selector a ‘textarea’, and add one error message too. try this. you can change or remove error message if it is not required.
Please note: simple layout didn’t support JS. if you are using simple layout then you cannot use any custom functionality.
Simple layout does support JavaScript, but jQuery needs to be loaded and selectors are a bit different. If using Simple layout, first add the below to the survey’s header:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
Then, add the below to the Text Entry question’s JavaScript in the OnReady section:
jQuery("#question-"+this.questionId+" .text-input").on("cut copy paste",function(e) {
e.preventDefault();
});
If using Flat, Modern, or Classic layouts, add the below to the Text Entry question’s JavaScript in the OnReady section:
jQuery("#"+this.questionId+" .InputText").on("cut copy paste",function(e) {
e.preventDefault();
});