Skip to main content

Related to my other post about spam leads…

 

I know there’s HTML which can be used with a Form input to disable paste. While I know some users may find it frustrating, I know it will really frustrate the people who are entering spam leads. They are not bots.

Anyone have any tips on how to do this?  This is what I have found online, just can’t see how to implement it in my form.

<input type="text" onpaste="return false;" ondrop="return false;" autocomplete="off" />

I figured this out. It was easier using a Javascript code.

 

This blocks right click and copy/paste.

 

<script>

document.addEventListener("contextmenu", function(event){

event.preventDefault();

alert('Right Click is Disabled');    

}, false);

</script>

 

<script>

document.querySelectorAll("p").forEach(elem => {

    elem.addEventListener("copy", event => {

      event.preventDefault();

    });

    elem.addEventListener("dragstart", event => {

      event.preventDefault();

    });

  });

 

  document.querySelectorAll("input").forEach(elem => {

    elem.addEventListener("copy", event => {

      event.preventDefault();

    });

    elem.addEventListener("paste", event => {

      event.preventDefault();

    });

    elem.addEventListener("drop", event => {

      event.preventDefault();

    });

  });

</script>


Awesome @go101 🙌🏻 thanks for sharing your solution. It’s always cool when the person looking for help answers their own question. 😂


Reply