How to stop event propagation on onclick event in html attribute?
<p>I have a html element with an onclick attribute and I need to prevent that event from bubbling up. I tried doing this:</p>

<pre><code>&lt;div onclick="event.stopPropagation();"&gt;
</code></pre>

<p>and this:</p>

<pre><code>&lt;div onclick="(function(event){event.stopPropagation();})();)"&gt;
</code></pre>

<p>But neither works. I absolutely need to do this in the html onclick attribute since this div is part of a Razor partial view and the script is set on the ViewData dictionary. How do I call event.stopPropagation() on the html onclick attribute?</p>

<p>Edit: the error in this case is that event is null. So for some reason, I can´t access the event like this.</p>