Selecting An Attribute From The Clicked href
<p>On a page I have multiple links all with a tracking code attached. The tracking code is different on every link. When I click on a link I want to select the tracking code attached to that href. If I just use </p>

<pre><code>$('.bannerLink').attr('data-trackingcode')
</code></pre>

<p>It'll just select the first link rather than the one I click on. How do I select the one I just clicked on </p>

<pre><code>&lt;div class="container"&gt;
&lt;div&gt;
&lt;a href="someLink" class="bannerLink" data-trackingcode="trackingCodeA"&gt;
&lt;img src="//someImage.jpg" alt="Cereals"&gt;
&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class="container"&gt;
&lt;div&gt;
&lt;a href="someLink" class="bannerLink" data-trackingcode="trackingCodeB"&gt;
&lt;img src="//someImage.jpg" alt="Cereals"&gt;
&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class="container"&gt;
&lt;div&gt;
&lt;a href="someLink" class="bannerLink" data-trackingcode="trackingCodeC"&gt;
&lt;img src="//someImage.jpg" alt="Cereals"&gt;
&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;
</code></pre>