Event.target. Select the parent instead the child
<p>I would like to know if there is any chance of selecting only the parent div instead its child. An easy example would be this: </p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;body onclick="myFunction(event)"&gt;
  &lt;div style="border: solid black 2px"&gt;

    &lt;p&gt;Click on a paragraph. An alert box will alert the element 
       that triggered the event.&lt;/p&gt;

    &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The target property returns the element that 
       triggered the event, and not necessarily the eventlistener's element.&lt;/p&gt;
&lt;/div&gt;
&lt;script&gt;
  function myFunction(event) { 
    alert(event.target.nodeName);
  }
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>What I want is simple, I want to click in the div, (does not mind if it is on the p labels) and recieve the msg that div has been clicked.
By now if I click on p labels I am getting p msg.</p>

<p>The fact is that I am trying to select the div instead the p label only, for example to change all its color. Thank you all. </p>