jQuery select all elements with a common class
<p>I want to handle a click event across a set of links so tried to approach this by adding a secondary class like following:</p>

<pre><code>&lt;a href="..." class="foo external"&gt;Test 1&lt;/a&gt;
&lt;a href="..." class="bar external"&gt;Test 2&lt;/a&gt;
&lt;a href="..." class="car external"&gt;Test 3&lt;/a&gt;
&lt;a href="..." class="dar"&gt;Don't handle this one&lt;/a&gt;
</code></pre>

<p>Then tried this jquery selector to select the "external" class on links:</p>

<pre><code>$('a.external').click(function(e) {
    do something here...
});
</code></pre>

<p>However this isn't working like I expected. What's the right way to handle this?  Should I just use a wildcard selector like the following or is there a better way?</p>

<pre><code>$('[class^="someclass"]').click(function(e) {
 ....
});
</code></pre>
