title: Getting the name or id of an input, not the input value
body: <p>Simple question.</p>
  
  <pre><code>&lt;input type="text" value="Some text" name="thisname" id="thisid" /&gt;
  </code></pre>
  
  <p>How can I get the name of the id or name that is being used, instead of value.
  It is clear that value of this text-box is "Some text". But what I want is name of id and name being used now.</p>
  
  <p>To be more clear ... I want "thisid" or "thisname".</p>
  
  <p>See my code</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function() {
      $("p").parent(".selected").css("background", "#FF8877");
  
  });
  
  function add(name) {
      $("#" + name).parent().clone().insertAfter($("#" + name).parent());
  }
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;div&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;/div&gt;
  &lt;div class="selected"&gt;&lt;p name="name" id="name" onclick="add(this.name)"&gt;Hello Again&lt;/p&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any idea ?</p>