Skip to content
Related Articles

Related Articles

Improve Article

HTML | ondragend Event Attribute

  • Last Updated : 02 Aug, 2021

The ondragend event attribute works when the user finished the dragging of element. The drag and drop feature is common in HTML5. Any element can make draggable by using the HTML5 draggable attribute. 

Supported Tags : It supports all HTML elements. 


<element ondragend = "script">

Attribute Value: This event contains single attribute script which works when ondragend event called.

Note: Images and links are by default draggable.



<!-- HTML code to implement ondragend event using drag
and drop event attribute -->
        <title>ondragend Event Attribute</title>
            .box {
                width: 30%;
                height: 50px;
                border: 1px solid black;
            /* Function to start dragging */
            function starts_drag(event) {
                document.getElementById("demo").innerHTML =
                                      "Dragging is in work";
            /* Function to stop dragging */
            function end_drag(event) {
                document.getElementById("demo").innerHTML =
                                    "Dragging works properly";
            /* Function to allow drop content */
            function drop_allow(event) {
            /* Function to drop the content */
            function drop_event(event) {
                var data = event.dataTransfer.getData("Text");
        <!-- ondragend event starts from here -->
        <div class="box" ondrop="drop_event(event)"
            <p ondragstart="starts_drag(event)"
            draggable="true" id="gfg">GeeksforGeeks
        <div class="box" ondrop="drop_event(event)"
        <!-- ondragend event complete here -->
        <p id="demo"></p>


Supported Browser: The browser supported by ondragend event attributes are listed below: 

  • Google Chrome 4.0
  • Internet Explorer 9.0
  • Mozilla Firefox 3.5
  • Safari 6.0
  • Opera 12.0


Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :