<input onpaste="myFunction()" > - Javascript DOM Event

Javascript examples for DOM Event:onpaste

Description

The onpaste event occurs when the user pastes some content in an element.

Summary

Bubbles Yes
Cancelable Yes
Event type: ClipboardEvent
Supported HTML tags: All HTML elements

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="text" onpaste="myFunction()" value="Try to paste something in here" size="40">

<script>
function myFunction() {//from  ww  w . j  av a  2 s  . c om
    console.log("You pasted text!");
}
</script>

</body>
</html>

Related Tutorials