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, 2012Hoan 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
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

9 years ago Javascriptonpaste180
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
21,918 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
19,746 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
15,584 views
JQuery Allow only numeric characters or only alphabet characters in textbox
13,094 views
C# Read Json From URL And Parse/Deserialize Json
9,557 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
  • Research Paper Writing Service
  • Annotated Bibliography Example – How it Can Help You
  • Essay Writing Online Tips – How to Write Essays Online With Essay Proof Editing
  • Get Research Paper Assistance From Professional Help
  • Customized Essay Writing Agency – Why You Want It
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (28)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (62)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development