Problem returning a value from clicked link
<p>I have a set links on a page like this</p>

<pre><code>&lt;a href='' class='contact' data-index='1'&gt;One&lt;/a&gt;
&lt;a href='' class='contact' data-index='2'&gt;One&lt;/a&gt;
&lt;a href='' class='contact' data-index='3'&gt;One&lt;/a&gt;
</code></pre>

<p>I am trying to return the value of the data-index of each link when it is clicked but Whenever I click on each link, the data-index of the first link is always returned because jQuery will select all the links with class = 'contact' on the page. 
I am trying to figure out how to select the data-index of the clicked link.</p>

<p>I use something like this :</p>

<pre><code>var m_data = $("a#contact").attr("data-index");
</code></pre>

<p>I've also tried something like this :</p>

<pre><code>$("a#contact").click(function() {
  var data = $(this).data('index');
});
</code></pre>

<p>but data was undefined.</p>

<p>Please how do I do this? Thanks.</p>
