You are here: Reference > JavaScript > client-side > event handling > properties > mozUserCancelled (dataTransfer)

mozUserCancelled property (dataTransfer)

Browser support:
3.5
Returns whether the current drag-and-drop operation has been canceled by the user.
Note: The dataTransfer object and its mozUserCancelled property are supported in Firefox from version 3.5.
The mozUserCancelled property is only relevant for the ondragend event.

Syntax:

object.mozUserCancelled;
You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

One of the following values:
false
The drag operation was not canceled by the user.
true
The user pressed the escape button during the drag operation.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the mozUserCancelled property:
<head>
    <script type="text/javascript">
        function OnDragEnd (event) {
            if (event.dataTransfer) {
                if ('mozUserCancelled' in event.dataTransfer) {
                    if (event.dataTransfer.mozUserCancelled) {
                        alert ("The drag operation has been canceled.");
                    }
                    else {
                        alert ("The drag operation has been finished but not canceled.");
                    }
                }
                else {
                    alert ("Your browser does not support the mozUserCancelled property.");
                }
            }
            else {
                alert ("Your browser does not support the dataTransfer object.");
            }
        }
    </script>
</head>
<body>
    <div style="background-color:#d0f0a0; width:200px" ondragend="OnDragEnd (event)">
        Select and drag some text from this field and press the escape button during the drag operation.
    </div>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content