It can set or retrieve a Boolean value which tells whether the current event is canceled or not.The returnValue Event property tells if the default action for this event has been prevented or not. The value is set true by default, it allows default action to occur.
If we set the default value to false it will prevent the default action.
event.returnValue = bool; var booleanValue = event.returnValue;
If the event has not been canceled the return value is true and the return value is false if the event has been canceled or the default has been prevented.
Example 1: This example attempts to cancel the onclick and onchange events.
Example 2: It is similar to the last example, the difference is that it does not check the cancelable state of an event, it just attempts to cancel the onclick and onchange events.
- Google Chrome
- Apple Safari
- HTML | view Event Property
- HTML | defaultPrevented Event Property
- HTML | cancelable Event Property
- HTML | bubbles Event Property
- HTML | isTrusted Event Property
- HTML | currentTarget Event Property
- HTML | DOM timeStamp Event Property
- HTML | DOM cancelable Event Property
- HTML | DOM type Event Property
- HTML | DOM target Event Property
- HTML DOM window event property
- HTML | DOM fullscreenerror Event
- HTML | DOM onvolumechange Event
- HTML | DOM onopen Event
- HTML | DOM ondragleave Event
- HTML | oninvalid Event Attribute
- HTML | DOM onpaste Event
- HTML | onsubmit Event Attribute
- HTML | onunload Event Attribute
- HTML | onkeyup Event Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.