HTML cancelable Event Property

The cancelable event property in HTML checks whether an event is a cancelable event or not. The values include TRUE if it is a cancelable event, else FALSE is returned.

Following is the syntax −


Let us now see an example to implement the cancelable event property −


 Live Demo

<!DOCTYPE html>
   <h2>Checking cancelable event</h2>
   <p>The below button will display whether the event is cancelable or not.</p>
   <button onclick="myFunction(event)">Click me</button>
   <p id="myid"></p>
      function myFunction(event) {
         var val = event.cancelable;
         document.getElementById("myid").innerHTML = val;


Now, click on the button to display whether the event is cancelable or not. A boolean value would be returned −