How to disable Copy paste on Password Field

function disableCntrls(e){                
    if(e.keyCode==17 || e.keyCode==93){                   
           alert('Copy Paste not allowed.');
           return false;                    
    }
}

function disContextMenu(e){
     $(e).bind("contextmenu",function(e){
           return false;
      });
}
<input name="confirmPassWord" type="password"  onkeydown="return disableCntrls(event);" onmousedown="disContextMenu(this);"/>

Another Easiest way :

<input name="confirmPassWord" type="password"  onpaste="return false;"/>
Advertisements
This entry was posted in JSP. Bookmark the permalink.

2 Responses to How to disable Copy paste on Password Field

  1. Prasath says:

    wer should v paste this script ??????????????

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s