title: jQuery onclick: position X / Y
body: <p>I have a div with position relative in this div are another divs that are absolute positioned. Now I want to receive the PositionX and PositionY Coordinates. It works very well when I click on a "free" spot in the div but when I click on a absolute positioned element inside this div I get wrong coordinates.</p>
  
  <p><a href="https://jsfiddle.net/vqb56uf3/2/" rel="nofollow noreferrer">https://jsfiddle.net/vqb56uf3/2/</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(".relative").click(function(e) {
    $(".clickIndicator").css({
      "left": e.offsetX + "px",
      "top": e.offsetY + "px",
      "display": "block"
    });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.relative {
    position: relative;
    width: 500px;
    height: 300px;
    background: black;
  }
  .absolute {
    position: absolute;
    height: 30px;
    width: 30px;
    background: white;
  }
  .clickIndicator {
    position: absolute;
    border-radius: 100px;
    width: 10px;
    height: 10px;
    background: red;
    display: none;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="relative"&gt;
    &lt;div class="clickIndicator"&gt;&lt;/div&gt;
    &lt;div class="absolute" style="top: 30px; left: 90px;"&gt;&lt;/div&gt;
    &lt;div class="absolute" style="top: 200px; left: 340px;"&gt;&lt;/div&gt;
    &lt;div class="absolute" style="top: 140px; left: 79px;"&gt;&lt;/div&gt;
    &lt;div class="absolute" style="top: 230px; left: 211px;"&gt;&lt;/div&gt;
    &lt;div class="absolute" style="top: 90px; left: 450px;"&gt;&lt;/div&gt;
    &lt;div class="absolute" style="top: 80px; left: 260px;"&gt;&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>