title: How can I get id,class or name attr an element with jquery
body: <p>I'm new in jquery. How can I get name,ID or class name an element with jquery.I'm trying as;</p>
  
  <pre><code>&lt;div class="className" onclick="getname();"&gt;&lt;/div&gt;
  &lt;div id="idName" onclick="getName();"&gt;&lt;/div&gt;
  &lt;div name="attrName" onclick="getName()"&gt;&lt;/div&gt;
  
  function getName(){
  attrName = $(this).attr("name");
  alert(attrName);
  }
  </code></pre>
  
  <p>but doesn't work</p>