title: Using jQuery to delete all elements with a given id
body: <p>I have a form with several spans with <code>id=&quot;myid&quot;</code>. I'd like to be able to remove all elements with this id from the DOM, and I think jQuery is the best way to do it. I figured out how to use the <code>$.remove()</code> method to remove one instance of this id, by simply doing:</p>
  <pre><code>$('#myid').remove()
  </code></pre>
  <p>but of course that only removes the first instance of myid. How do I iterate over ALL instances of myid and remove them all? I thought the jQuery <code>$.each()</code> method might be the way, but I can't figure out the syntax to iterate over all instances of myid and remove them all.</p>
  <p>If there's a clean way to do this with regular JS (not using jQuery) I'm open to that too. Maybe the problem is that id's are supposed to be unique (i.e. you're not supposed to have multiple elements with <code>id=&quot;myid&quot;</code>)?</p>