Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home Javascript Disable Paste On Textbox With JavaScript

Disable Paste On Textbox With JavaScript

It’s a short article with just one thing that let you know How to disable pasting something on a textbox. You may already see that some websites don’t allow to paste content from clipboard to their textbox in registration forms, especially with email address, phone or password field. They want people have to type/re enter their information carefully before submitting.

In registration forms that require enter email or phone twice (confirm email or phone), I usually using Short key Shift + Tab to go back the previous textbox, Ctrl + C to copy the text, Tab to go back the current textbox then Ctrl + V to paste the content. Those steps save my time. However, sometime I made mistakes by typing wrong information and waste more time to fix.

Anyway, disable pasting on important fields such as email address or phone number (2-ways communication) is useful for both users (who provide information or try to register) and website owners (who collect information) because this avoids providing wrong information and getting wrong information, I think.

JavaScript disable paste on textbox

When focus on the textbox below, people won’t be able to paste anything. And the magic thing here is just: onpaste=”return false”

[html] <input name="txt" type="text" id="txt" onpaste="return false" />
[/html]

View demonstration here and try it yourself.

Jan 16, 2012 Hoan Huynh
C# Parse Item Value And Name In XML StringResize picture by using Paint
You Might Also Like:
  • Javascript Problem Set focus textbox on Firefox
  • JQuery Create Textbox With Count Down Limit Characters
  • Get Image Width Height With JQuery And JavaScript
  • JavaScript Detect Protocol (HTTP/ HTTPS) To Load Or Handle Accordingly
  • ASP.NET JQuery Autocomplete Textbox
  • How To Track Website With Multiple Google Analytisc Accounts
  • JQuery Allow only numeric characters or only alphabet characters in textbox
  • Disable Auto Save Password In HTML Form Or TextBox
  • Javascript generate a random number using Math.random
  • Create Count Down Download Page With JavaScript
  • http://amzn.to/QuickSalesTips Daniel Milstein

    That is so true. Your computer tips can be a great help to many readers. One thing I learned before I became a bestselling author and long before Inc Magazine voted my company as one of the fastest growing companies is to know the keyboard shortcuts for me to be able to use my computer easily and effectively.

  • http://www.yphpmysql.com/php-services/php-mysql-development/ PHP mysql development

    A wonderful article you posted. That is so informatory and creative.Please keep these excellent posts coming.

Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at hoan@4rapiddev.com

6 years ago Javascriptonpaste124
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
14,301 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
10,259 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
10,259 views
JQuery Allow only numeric characters or only alphabet characters in textbox
8,977 views
Firefox Can Not Connect To Proxy Server
Fix Can Not Connect To Proxy Server In Firefox, Google Chrome And Internet Explorer
5,869 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Magento Fatal error: Unsupported operand types
  • Ionic bower the name contains uppercase letters
  • PHP Magento Get Manufacturer Name And ID From Magento Product ID
  • Know Simple Hacks To Systematize Media Library in WordPress
  • A handy guideline on adding custom menu item in WordPress admin
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (26)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (140)
EMAIL SUBSCRIPTION

Sign up for our newsletter to receive the latest news and event postings.

Recommended
  • CDN
  • Hosting
  • Premium Themes
  • VPS
2014 © 4 Rapid Development