cancelableEvent Property
Event Object
Definition and Usage
The cancelable event returns a Boolean value. If the default action associated with the event can be canceled with the preventDefault() method, it is true, otherwise it is fasle.
Syntax
event.cancelable
Example
Example
The following example will detect whether the event that occurred is a cancelable event:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function myFunction(e){
alert(e.cancelable);
}
</script>
</head>
<body>
<p onclick="myFunction(event)">Click this paragraph, if the event is cancelable, an alert box will pop up.</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function myFunction(e){
alert(e.cancelable);
}
</script>
</head>
<body>
<p onclick="myFunction(event)">Click this paragraph, if the event is cancelable, an alert box will pop up.</p>
</body>
</html>
Try it »
Event Object Other Extensions