title: alert individual attribute value
body: <p>I want to identify each element by it's name attribute. Each element has the same class and will ultimately contain differing dynamic information.</p>
  
  <p>For example I would want the following code to alert the individual element's name value:</p>
  
  <p>html:</p>
  
  <pre><code>&lt;p class="pexample" name="0"&gt;this is p #1&lt;/p&gt;
  &lt;p class="pexample" name="1"&gt;this is p #2&lt;/p&gt;
  &lt;p class="pexample" name="2"&gt;this is p #3&lt;/p&gt;
  </code></pre>
  
  <p>jquery:</p>
  
  <pre><code>$('p').on('click', function() {
      if ($('p').attr('name') !== undefined) {
          alert($('p').attr('name'));
      }
  })
  </code></pre>
  
  <p>Here is a jsfiddle.. <a href="http://jsfiddle.net/XG7nd/1/" rel="nofollow">http://jsfiddle.net/XG7nd/1/</a></p>
  
  <p>This code however only alerts the initial elements name value. Help is greatly appreciated.</p>