title: event: "Deprecated symbol used, consult docs for better alternative"
body: <p>It's been a while that PyCharm (I suppose it's the same with WebStorm and other JetBrains IDEs) raise a weak warning on the <code>event</code> variables I use in my code.</p>
  <p>For instance in the following code</p>
  <pre class="lang-html prettyprint-override"><code>&lt;div id=&quot;my-div&quot; onclick=&quot;event.preventDefault();&quot;&gt;...&lt;/div&gt;
  </code></pre>
  <p>PyCharm displays this message &quot;Deprecated symbol used, consult docs for better alternative&quot;.</p>
  <p>The problem seems to be that the <code>event</code> variable refers to <code>Window.event</code>, and according to <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/event" rel="nofollow noreferrer">MDN Web Docs</a>:</p>
  <blockquote>
  <p>You should avoid using this property in new code, and should instead use the Event passed into the event handler function. This property is not universally supported and even when supported introduces potential fragility to your code.</p>
  </blockquote>
  <p>I know that a correct workaround would be to write in a javascript tag:</p>
  <pre class="lang-js prettyprint-override"><code>document.getElementById(&quot;my-div&quot;).addEventListener(&quot;click&quot;, function(event) {
    console.log(&quot;And use this &quot; + event + &quot; instead&quot;);
  });
  </code></pre>
  <p>I am just wondering what would be, if it exists, the correct way to use events in the HTML code (<code>onclick</code> attribute).</p>