title: How to add HTML after image then wrapping in a div?
body: <p>In my function I would like to take an image add a dynamically created caption then wrap it all neatly in a div.</p>
  
  <p>Before:</p>
  
  <pre><code>&lt;img src="whatever" /&gt;
  </code></pre>
  
  <p>After:</p>
  
  <pre><code>&lt;div class="imageBlock"&gt;
   &lt;img src="whatever" /&gt;
   &lt;span class="caption"&gt;The Caption&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is what I currently have:</p>
  
  <pre><code>var imageCaption = '&lt;span class="caption"&gt;'+array[1]+'&lt;/span&gt;'
  $(this).after(imageCaption).wrap('&lt;div class="imageBlock '+array[0]+'" /&gt;');
  </code></pre>
  
  <p>This is working BUT is placing the span outside of the closing <code>div</code> tag.</p>