HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
HTML Event Attributes : Execute a JavaScript when pasting some text in an <input> element
The onpaste attribute fires when the user pastes some content in an element.
Event Attribute | |||||
---|---|---|---|---|---|
onpaste | Yes | Yes | Yes | Yes | Yes |
Value | Description |
---|---|
script | The script to be run on onpaste |
Supported HTML tags: | ALL HTML elements |
---|
Execute a JavaScript when pasting some text in a <p> element (Note that contenteditable is set to "true"):
<p contenteditable="true" onpaste="myFunction()">Try to paste something inside this paragraph.</p>
HTML reference: oncopy event
HTML reference: oncut event
HTML DOM reference: onpaste event
❮ HTML Event Attributes