title: jquery right mouse click div
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1206203/how-to-distinguish-between-left-and-right-mouse-click-with-jquery">How to distinguish between left and right mouse click with jQuery</a>  </p>
  </blockquote>
  
  
  
  <p>How to open context meniu when I click with right mouse click inside the div. Because when I click with right mouse button inside div its fadeouts?</p>
  
  <p>Javascript</p>
  
  <pre><code>$("#link").click(function(e){
     e.stopPropagation();
     div = $("#mydiv").fadeToggle(300);
  });
  
  $("#mydiv").click(function(e){
     e.stopPropagation();
  });
  
  $(document).click(function(e){
     $('#mydiv').fadeOut(200);
  });
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;a id="link"&gt;Click&lt;/a&gt;
  &lt;div id="mydiv" style="width: 200px; height: 200px;"&gt;Hello&lt;/div&gt;
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>Javascript</p>
  
  <pre><code>$("#link").click(function(e){
     e.stopPropagation();
     div = $("#mydiv").fadeToggle(300);
  });
  
  $("#good_buttom").click(function(e){
     e.stopPropagation();
     div = $("#hide").fadeToggle(300);
  });
  
  $("#mydiv").mousedown(function(e) {
  switch (e.which) {
      case 1:
           e.stopPropagation();
           $('#mydiv').fadeOut(200);
          break;
      case 2:
          alert('2');
          break;
      case 3:
          alert('3');
          break;
      default:
          alert('You have a strange mouse');
  }
  });
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;a id="link"&gt;Click&lt;/a&gt;
  &lt;div id="mydiv" style="width: 200px; height: 200px;"&gt;
      &lt;button id="good_button"&gt;Click IT&lt;/button&gt;
      &lt;div id="hide" style="display:none;"&gt;Show up.&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>