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 −

event.cancelable

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

Example

 Live Demo

<!DOCTYPE html>
<html>
<body>
   <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>
   <script>
      function myFunction(event) {
         var val = event.cancelable;
         document.getElementById("myid").innerHTML = val;
      }
   </script>
</body>
</html>

Output

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

Updated on: 29-Jun-2020

73 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements