/

HTML / CSS / JavaScript Tutorial

HTML Event attribute: oncopy

[this page | pdf | back links]

The HTML oncopy attribute specifies the event that is triggered when the content of an element is copied. It applies to all visible elements.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
oncopy: try to copy this <span style="background-color: yellow;" oncopy="myOncopy()">element</span><br> 

<script>
function myOncopy() {alert("Copying element");}
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile