HTML | isTrusted Event Property
The isTrusted event property is used for checking whether an event is trusted or not.
Return Value: It returns True if an event is trusted else it returns false.
Syntax :
event.isTrusted
Below program illustrates the isTrusted event property :
Example: To find out if a specific event is trusted or not.
<!DOCTYPE html> <html> <head> <title>isTrusted Event Property in HTML</title> <style> h1 { color: green; } h2 { font-family: Impact; } body { text-align: center; } </style> </head> <body onclick="MyEvent(event)"> <h1>GeeksforGeeks</h1> <h2>isTrusted Event Property</h2> <p>Double Click the "Check Event" button to check whether the event is trusted or not.</p> <button ondblclick="MyEvent(event)"> Try it </button> <script> // Check whether the event is trusted or not. function MyEvent(event) { if ("isTrusted" in event) { if (event.isTrusted) { alert("The " + event.type + " is a trusted event."); } else { alert("The " + event.type + " is not a trusted event."); } } else { alert("Your browser does not support " +"the isTrusted property"); } } </script> </body> </html> |
chevron_right
filter_none
Output:
Before clicking the button:

After clicking the button:

Supported Browsers:
- Opera
- Internet Explorer
- Google Chrome
- Firefox
Recommended Posts:
- HTML | bubbles Event Property
- HTML | DOM target Event Property
- HTML | currentTarget Event Property
- HTML | DOM timeStamp Event Property
- HTML | DOM cancelable Event Property
- HTML | view Event Property
- HTML | defaultPrevented Event Property
- HTML | cancelable Event Property
- HTML | DOM type Event Property
- HTML | returnValue Event Property
- jQuery | event.data Property
- jQuery | event.delegateTarget Property
- jQuery | event.namespace Property
- jQuery | event.currentTarget Property
- HTML | DOM ondblclick Event
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.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.



