Skip to content
Related Articles

Related Articles

HTML | isTrusted Event Property

View Discussion
Improve Article
Save Article
  • Last Updated : 22 Jan, 2019

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 :


Below program illustrates the isTrusted event property :

Example: To find out if a specific event is trusted or not.

<!DOCTYPE html>
    <title>isTrusted Event Property in HTML</title>
        h1 {
            color: green;
        h2 {
            font-family: Impact;
        body {
            text-align: center;
<body onclick="MyEvent(event)">
    <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
        // 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");

Before clicking the button:

After clicking the button:

Supported Browsers:

  • Opera
  • Internet Explorer
  • Google Chrome
  • Firefox

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!