How to disable copy paste and autocomplete for an HTML textbox

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

22 Comments »

  1. Anil Kumar said

    On Mozilla its not workingn :(

    • akash said

      Very Nice.

      A Good and Simple Stuff.

  2. Firos said

    It will work fine in IE. The properties like onDrop, onPaste of html textbox are only for IE. It is better to use some javascript function instead.

  3. It may only work in IE, but that saves me a lot of spam from people who use a contact form to paste some huge block of text to advertise their website. I feel a contact form (as in my case) is for requesting information, not advertising. It was a BIG Help. Thanks.

  4. Veera said

    Indeed, It is a very good one. It will be very helpful if somebody gives browse-free solution

  5. eanirudh said

    its works on IE only, can u provide code which can work on all browser.
    ==================================
    http://eanirudh.wordpress.com
    ==================================

  6. shaik ismail said

    Hi its good i like it.. very very thanks….thanks a lot…………..

  7. Melonheadj44 said

    It works in Firefox and IE and Chrome…

    • ragini said

      noops its nt working vid chrome n mozilla bt only vid ie, can anybdy give me solution for chrome n mozilla????

  8. SeanG said

    Google uses autocomplete=”off” on their main search field.

  9. santosh said

    onDrag, onDrop not working in Mozilla

  10. Tania said

    Thank’s for this piece of code, works fine on IE, Firefox and Opera, that’s enought for me. I’ve tried with javascript and it didn’t work, but with this simple one it did!

  11. Coder said

    A believe a THANK YOU is in order.
    The code works great.

  12. Utsav Sharma said

    copy paste disabling works with IE, MOZILLA, CHROME but drag is still possible in mozilla and chrome. Any way thanks. keep up the good work.

    • rocky said

      it works in ie and mozilla….but when js is diabled it dosent work in mozilla…any ideas?

  13. Shakil said

    it was very helpful.. thanks

  14. Riz said

    amazingg…….

  15. Suhani said

    Great !!!!!

    just two attributes and my work done ! :)

    Thank you

  16. hidfifffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

  17. [...] Related link: http://unnisworld.wordpress.com/2007/10/31/how-to-disable-copy-paste-and-autocomplete-for-an-html-te… [...]

  18. Hego555 said

    ondragstart=”return false” <– WORKS ON CHROME!!!

    (Didnt test ON FireFox)

  19. [...] Source Posted in Coding SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail « [jQuery] how to put a link in a fancybox title No Comments Yet [...]

RSS feed for comments on this post · TrackBack URI

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.