title: How defined in jQuery was it a regular click on the same element or double-click?
body: <p>How i can defined in jQuery was it a regular click on the same element or double-click?  </p>
  
  <p>For example we have element like this:  </p>
  
  <pre><code>&lt;div id="here"&gt;Click me once or twice&lt;/div&gt;
  </code></pre>
  
  <p>And we need to perform different actions after regular click and double-click.  </p>
  
  <p>I tried something like this  </p>
  
  <pre><code>$("#here").dblclick(function(){
      alert('Double click');
  });
  $("#here").click(function(){
      alert('Click');
  });
  </code></pre>
  
  <p>But, of course, it doesn't work, everytime works only 'click'.</p>
  
  <p>Then, some people showed me this:  </p>
  
  <pre><code>var clickCounter = new Array();
  $('#here').click(function () {
  clickCounter.push('true');
  setTimeout('clickCounter.pop()', 50);
  if (clickCounter.length &gt; 2) {
      //double click
      clickCounter = new Array(); //drop array
  } else {
      //click
      clickCounter = new Array(); //drop array    !bug ovethere
  }
  });
  </code></pre>
  
  <p>Here we tried to set the interval between clicks, and then keep track of two consecutive events, but this have one problem.. it doesn't work too.<br>
  So, someone knows how to do this? or can someone share a link to the material, where i can read about it?</p>