How to get a name of the clicked <a> tag
<p>This is my HTML code :</p>

<pre><code>&lt;div class="span4"&gt;
&lt;div class="hero-unit" style="padding:10px 10px 10px 10px"&gt;
    &lt;div class="accordion" id="accordion2"&gt;
        &lt;div class="accordion-group"&gt;
            &lt;div class="accordion-heading"&gt;
                &lt;a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne"&gt;
                North Delhi
                &lt;/a&gt;
            &lt;/div&gt;
            &lt;div style="height: 0px;" id="collapseOne" class="accordion-body collapse"&gt;
                &lt;div class="accordion-inner"&gt;
                    &lt;ol&gt;
                        &lt;li&gt;&lt;a id='link' href="#" name="Some name1 "&gt;Some link1&lt;/a&gt; &lt;/li&gt;
                        &lt;li&gt;&lt;a id='link' href="#" name="Some name2"&gt;Some link2&lt;/a&gt; &lt;/li&gt;
                    &lt;/ol&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
</code></pre>

<p>and this is my jQuery code </p>

<pre><code>$(document).ready(function() {
    $('#link').click(function() {
        var n = $(this).attr(name); //alerts undefined
        alert(n);
        $('#results').html('&amp;nbsp;').load('/donate/?n=' + n);
    });
});
</code></pre>

<p>My HTML code has several accordion-inner divs with multiple links. I want to get the name attribute of the clicked link. This code alerts me undefined check my jQuery code and please tell me what am i doing wrong?</p>

<p>I am new to jquery so please help.</p>
