Iterate over attributes in DOM
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2048720/get-all-attributes-from-a-html-element-with-javascript-jquery">Get all Attributes from a HTML element with Javascript/jQuery</a>  </p>
</blockquote>



<p>I need to retrieve all attributes of a DOM element. I've seen the <code>getAttribute()</code> method, but I don't know the names of the attributes in advance. If I use <code>getElementById()</code> to retrieve an element, how do I then access all attributes of that element and their values?</p>
