event: "Deprecated symbol used, consult docs for better alternative" : <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="my-div" onclick="event.preventDefault();"&gt;...&lt;/div&gt;
</code></pre>

<p>PyCharm displays this message "Deprecated symbol used, consult docs for better alternative".</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="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><code>document.getElementById("my-div").addEventListener("click", function(event) {
  console.log("And use this " + event + " instead");
});
</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>

<p>Thank you in advance!</p>
