JQuery . after not working on class added via JQuery
<p>This question is in relation to a question I posted yesterday. The link -http://stackoverflow.com/questions/12636348/how-to-add-a-different-class-to-the-same-class-in-jquery . The question and problem now is that I will like to have a div added after the div with the class being added. The problem is the script that I'm using adds the div only to an existing/default class name and not the added class via JQuery. The script is below.</p>

<pre><code> $(document).ready(function(){$('.example').each(function(i){$(this).addClass("ex" + i);});

 $('.ex0').after(function(){return'&lt;div class="afterdiv"&gt;&lt;a class="afterdiva1" href="#" title="Text."&gt;&lt;/a&gt;&lt;a class="afterdiva2" href="#" title="Text."&gt;&lt;/a&gt;&lt;/div&gt;'});
</code></pre>

<p>The default output is:</p>

<pre><code>      &lt;div class="example"&gt;&lt;/div&gt;
</code></pre>

<p>The final html output should read as:</p>

<pre><code>      &lt;div class="example ex0"&gt;&lt;/div&gt;
      &lt;div class="afterdiv"&gt;
      &lt;a class="afterdiva1"&gt;&lt;/a&gt;
      &lt;a class="afterdiva2"&gt;&lt;/a&gt;
      &lt;/div&gt;
</code></pre>

<p>Update- I apologize for not clarifying that each div needs to be unique to/per class. Sincere apologies (I'm new to asking for help here or anywhere else for that matter). </p>
