jQuery: Hiding a menu with click event
<p>I am struggling with an issue regarding these mouseover/out events. There is an element I click on and it should open up a menu near the cursor (works). After clicking the element it should disapear (doesn't work). It's a combination of d3js and jQuery.</p>

<p>Maybe you have a far better approach which doesn't come up with this problems.</p>

<p><strong>jQuery handling the click Event</strong></p>

<pre><code>$(".btcaccount").click(function(evt){
  $(".btcaction").css({
    top: evt.pageY+1,
    left: evt.pageX+1
  }).show();
});
</code></pre>

<ul>
<li>.btcaccount: the clickable element</li>
<li>.btcaction: the menu which appears</li>
</ul>

<p><strong>jQuery handling the mouseout event</strong></p>

<pre><code>$(".btcaction").click(function(evt){
  $(this).css({
    display: none
   });
});
</code></pre>

<p><strong>Some HTML</strong></p>

<pre><code>&lt;ul class="btcaction"&gt;
  &lt;li&gt;Actions
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="#"&gt;Action 1&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Action 2&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p><strong>d3js - .btcaccount class</strong></p>

<pre><code>var circle = svg.append("g").selectAll("circle")
    .data(force.nodes())
  .enter().append("circle")
    .attr("r", 10)
    .attr("class", "btcaccount")
    .call(force.drag);
</code></pre>

<p><strong>EDIT</strong>
Under JsFiddle it somehow doesn't run but I included all code :-(</p>

<p><a href="https://jsfiddle.net/k1yqLbsh/1/" rel="nofollow noreferrer">JsFiddle Code</a></p>

<p><a href="https://i.stack.imgur.com/iXUiz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iXUiz.png" alt="Screenshot"></a></p>