/

HTML / CSS / JavaScript Tutorial

HTML Event attribute: ondragover

[this page | pdf | back links]

The HTML ondragover attribute specifies the event that is triggered when an element is being dragged over a valid drop target. It applies to all visible elements.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
ondragover: try dragging the yellow
<span style="background-color: yellow;">element</span>
over the orange
<span style="background-color: orange;" ondragenter="myOndragover()">element</span>
<br><br><b id="drag"></b><br>

<script>
function myOndragover() {document.getElementById("drag").textContent="Dragged over";}
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile