XML DOM cancelable event attribute

Definition and usage

The cancelable event returns a boolean value. If used preventDefault() methodIf the default action associated with the event can be canceled, it is true, otherwise it is false.

Syntax

event.cancelable

Example

The following example explains how to check if the event that occurs is a cancelable event:

<html>
<head>
<script type="text/javascript">
function isEventCancelable(event)
  { 
  alert(event.cancelable);
  }
</script>
</head>
<body onmousedown="isEventCancelable(event)">
<p>Click somewhere in the document. 
An alert box will tell if the 
event is a cancelable event.</p>
</body>
</html>

Try It Yourself (TIY)

Cancelable event
Check if the event is a cancelable event (Internet Explorer browser does not support).