What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.

  • Profile Image

    How to create a textbox that prevent copy and paste?

    Asked by Apriyanto Salim on August 09, 2011 at 06:54 AM

    I want to create a textbox that the users can't copy and paste from the word processor. What can I do to get this feature?

  • Profile Image

    Answered by allanftd on August 09, 2011 at 07:43 AM

    Hi Apriyanto,

    Please try adding these attributes into your textbox's <input> tag:

    onCopy=”return false” onDrag=”return false” onDrop=”return false” onPaste=”return false” autocomplete=off


    <INPUT size=12 name=”Sample Name” maxlength=12 onCopy=”return false” onDrag=”return false” onDrop=”return false” onPaste=”return false” autocomplete=off>

    You need to get the full source code of your form in order to accomplish this. 

    Please let us know if you have any ther questions or concerns. Thank you for using JotForm!


  • Profile Image

    Answered by apri_07 on August 12, 2011 at 05:23 AM

    I've tried to change the source code as it's written, but the copy and paste feature is still enabled.

  • Profile Image
    JotForm Support

    Answered by NeilVicente on August 12, 2011 at 07:18 AM


    To answer in behalf of our colleague, here's something I stumbled upon while searching the net:

    Paste the code below anywhere in your page's source code

    <script type="text/javascript">
    (function () {
        var onload = window.onload;

        window.onload = function () {
            if (typeof onload == "function") {
                onload.apply(this, arguments);

            var fields = [];
            var inputs = document.getElementsByTagName("input");
            var textareas = document.getElementsByTagName("textarea");

            for (var i = 0; i < inputs.length; i++) {

            for (var i = 0; i < textareas.length; i++) {

            for (var i = 0; i < fields.length; i++) {
                var field = fields[i];

                if (typeof field.onpaste != "function" && !!field.getAttribute("onpaste")) {
                    field.onpaste = eval("(function () { " + field.getAttribute("onpaste") + " })");

                if (typeof field.onpaste == "function") {
                    var oninput = field.oninput;

                    field.oninput = function () {
                        if (typeof oninput == "function") {
                            oninput.apply(this, arguments);

                        if (typeof this.previousValue == "undefined") {
                            this.previousValue = this.value;

                        var pasted = (Math.abs(this.previousValue.length - this.value.length) > 1 && this.value != "");

                        if (pasted && !this.onpaste.apply(this, arguments)) {
                            this.value = this.previousValue;

                        this.previousValue = this.value;

                    if (field.addEventListener) {
                        field.addEventListener("input", field.oninput, false);
                    } else if (field.attachEvent) {
                        field.attachEvent("oninput", field.oninput);

    Insert onpaste="return false;" in every input tag in your form's code. 

    For example:

    <textarea id="input_12" class="form-textarea" name="q12_test" cols="40" rows="6" onpaste="return false;"></textarea>

    <input type="text" id="input_9" name="captcha" style="width:130px;" onpaste="return false;"/>


    Hope this works for you. Thanks!



    Source: http://stackoverflow.com/questions/1226574/disable-copy-paste-into-html-form-using-javascript

  • Profile Image

    Answered by Queensford on February 19, 2017 at 07:55 PM

    Is it possible to do this in Jotform Form Element? For example, if there is an essay text area, we don't want students to copy-paste essay into that text area.
  • Profile Image
    JotForm Support

    Answered by ashwin_d on February 19, 2017 at 11:12 PM

    Hello Queensford,

    I have moved your question to a new thread so that we can address this issue separately. You will be answered in the following thread:  https://www.jotform.com/answers/1070674

    Thank you!