title: How to copy all the attributes of one element and apply them to another?
body: <p>How do I copy the attributes of one element to another element?</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;select id="foo" class="bar baz" style="display:block" width="100" data-foo="bar"&gt;...&lt;/select&gt;
  
  &lt;div&gt;No attributes yet&lt;/div&gt;
  </code></pre>
  
  <p>JavaScript</p>
  
  <pre><code>var $div = $('div');
  var $select = $('select');
  
  //now copy the attributes from $select to $div
  </code></pre>