Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
168
rated 0 times [  174] [ 6]  / answers: 1 / hits: 128591  / 12 Years ago, tue, october 9, 2012, 12:00:00

Html FIle Disable drop paste in HTML input fields..


More From » html

 Answers
25

You can disable paste in your input as follows:


html:


<input type="text" value="" id="myInput">

javascript:


window.onload = () => {
const myInput = document.getElementById('myInput');
myInput.onpaste = e => e.preventDefault();
}

Talking about security, I wouldn't say that this makes any impact. You would usually use client side and well as server-side validation of data submitted by the user.


[#82656] Monday, October 8, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
frederickmohamedw

Total Points: 21
Total Questions: 123
Total Answers: 105

Location: The Bahamas
Member since Tue, Apr 27, 2021
3 Years ago
frederickmohamedw questions
Wed, Sep 23, 20, 00:00, 4 Years ago
Sat, Jul 18, 20, 00:00, 4 Years ago
Sun, Apr 26, 20, 00:00, 4 Years ago
Sat, Jan 11, 20, 00:00, 4 Years ago
Fri, Dec 27, 19, 00:00, 4 Years ago
;