javascript anchor avoid scroll to top on click
<p>I created a function in javascript that i add to an anchor as such </p>

<p>javascript :</p>

<pre><code>somefunction = function () {alert('foo')}
</code></pre>

<p>html :</p>

<pre><code>&lt;a href="#" onclick="return somefunction()"&gt;anchor&lt;/a&gt;
</code></pre>

<p>everytime i click on the anchor the function executes but the screen scrolls to the top</p>

<p>I know i could do this </p>

<pre><code>&lt;a href="javascript:void(0)" onclick="return somefunction()"&gt;anchor&lt;/a&gt;
</code></pre>

<p>but I have seen the first option implemented without this hick up of scrolling up</p>

<p>is there any trick to it?</p>

<p>thank you</p>
