<p>I want to make a link call a Javascript function through the onclick event and not do anything else (follow the link). What is the best way to do that? I usually do this:</p>

<pre><code>&lt;a href="#" onclick="foo()"&gt;Click&lt;/a&gt;
</code></pre>

<p>But I'm not sure that is the best way and in this case it is navigating to page.html# which isn't good for what I'm doing.  </p>

```
```
<a href="javascript: foo()" >Click</a>
```
```