I need to block ctrl + v in a text box


I want to create an input type="text" that does not allow anything to be pasted into it. You do not need to have any alert or anything, just do not allow the paste.

asked by anonymous 27.02.2014 / 01:58

4 answers


If you are using jQuery in your application, you can do as follows:

In your HTML

<input type="text" id="texto"></input>

In your Javascript

$(document).ready(function() {

    $("#texto").bind('paste', function(e) {


If you need examples of how to detect copy and clipping of text, this post has some cool examples:

27.02.2014 / 02:18

Just to add an alternative to the options mentioned above:

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

The onpaste attribute takes the paste event and the ondrop drag. This way, the user will be prevented either from pasting text (ctrl + v or right mouse button) or dragging text with the mouse into that field.

17.07.2015 / 19:41

To avoid Crtl + C Crtl + V or Crtl + X, you can use it as well ...

 $(document).ready(function() {
     $('#texto').bind('cut copy paste', function(event) {
27.02.2014 / 19:07

If it's pure javascript, this inline template is for:

document.getElementById('texto').onpaste = function(){
    return false;

If you do not want to use inline mode, you can do this (IE > 9):

        return false;

In this mode, if you need to include IE below version 10, you need to condition the expressions using attachEvent for IE and addEventListener for the rest of the browsers.

Good luck.

01.03.2014 / 16:26