title: How to prevent redirect after hyperlink click?
body: <p>I have following html+ js code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;a href="#" id=key onclick="func(0)"&gt;foo&lt;/a&gt;
  
  &lt;/body&gt;
  
  &lt;script type="text/javascript"&gt;
  function func(k){
      alert(1);
      return false;
  }   
  &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Can you explain how to refactor following code that after click on href code <code>func</code> executes but # doesn't add to the URL and page shouldn't be reload? </p>