title: Jquery .insertAfter() inserts multiple times
body: <p>I have a web app that uses jquery to inser some html on to the dom: </p>
  
  <pre><code>    $('&lt;div /&gt;').html('&lt;span class="' + someID + '-id"&gt;SomeText&lt;/span&gt;').insertAfter($(".someidentifier"));
  </code></pre>
  
  <p>The problem I'm having is that there can be many elements with <code>someidentifier</code> class and with each of them, this code will run so as you can imagine, if I have two of them:</p>
  
  <pre><code>    &lt;div class="someidentifier"&gt;Some text&lt;/div&gt;
      &lt;div class="someidentifier"&gt;Some text&lt;/div&gt;
  </code></pre>
  
  <p>this code will produce the following in the dom:</p>
  
  <pre><code>    &lt;div class="someidentifier"&gt;Some text&lt;/div&gt;
           &lt;span class="3123564654-id"&gt;SomeText&lt;/span&gt;
           &lt;span class="3123564654-id"&gt;SomeText&lt;/span&gt;
      &lt;div class="someidentifier"&gt;Some text&lt;/div&gt;
           &lt;span class="3123564654-id"&gt;SomeText&lt;/span&gt;
           &lt;span class="3123564654-id"&gt;SomeText&lt;/span&gt;
  </code></pre>
  
  <p>where as it should be:</p>
  
  <pre><code>    &lt;div class="someidentifier"&gt;Some text&lt;/div&gt;
           &lt;span class="3123564654-id"&gt;SomeText&lt;/span&gt;
      &lt;div class="someidentifier"&gt;Some text&lt;/div&gt;
           &lt;span class="3123564654-id"&gt;SomeText&lt;/span&gt;
  </code></pre>
  
  <p>so I thought of using the <code>.next()</code> function and check to see if the next sibling has the class that I'm trying to output and if so cancel the insert. This is the part that I just can't figure out as I'm just saying <code>insertAfter(jQueryObject)</code> and I don't know how to intercept it and cancel it. I should note that I can't use an if statement around it because the <code>jQueryObject</code> in this case would both <code>div</code> already.</p>
  
  <p>Can I modify the selector to not include the object if it has a <code>span</code> with a class of <code>3123564654-id</code> as the next sibling?</p>