title: jquery add new div onclick
body: <p>I have a list of div</p>
  
  <pre><code>&lt;li class="comment"&gt;
       &lt;div class="comment-body" id="comment-body"&gt;
              &lt;div class="comment-author vcard"&gt;
                  &lt;div class="lightbox-photo"&gt;
                      &lt;a class="image-overlay" href='&lt;%# "Foto/profil/foto_buyuk/" + Eval("Yorum_Profil_Foto_Buyuk") %&gt;' data-rel="prettyPhoto" title='&lt;%# Eval("Yorum_UserName")%&gt;'&gt;&lt;img src='&lt;%# "Foto/profil/foto_kucuk/" + Eval("Yorum_Profil_Foto_Kucuk") %&gt;' alt='&lt;%# Eval("Yorum_UserName")%&gt;' class="avatar" /&gt;
                      &lt;/a&gt;
                   &lt;/div&gt;
                   &lt;cite class="fn"&gt;&lt;asp:HyperLink ID="linkProfil" runat="server" Text='&lt;%# Eval("Yorum_UserName")%&gt;' NavigateUrl='&lt;%# "~/profil.aspx?user_id="+Eval("User_ID") %&gt;'&gt;&lt;/asp:HyperLink&gt;&lt;/cite&gt;
                   &lt;cite class="fn-time"&gt;&lt;/cite&gt; 
                 &lt;/div&gt;
          &lt;p&gt;&lt;%# Eval("Yorum_Text")%&gt;&lt;/p&gt;
             &lt;/div&gt;
           &lt;/div&gt;
       &lt;/div&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>I want to add a new div on div click. I wrote jquery codes but it doesnt work.</p>
  
  <pre><code>function addcommentdiv () {
      var NewContent = '&lt;div class=""&gt;&lt;input name="name" type="text" id="name" size="20" value="" style="height:20px; margin-top:10px; width:480px;margin-left:90px; font-size:14px;" /&gt;&lt;/div&gt;'
      $('.comment-body').click(function () {
  
          var index2 = $('.comment-body').index(this);
          if (NewContent != '') {
              $('.comment-body').eq(index2).after(NewContent);
              NewContent = '';
  
          }
          else {
              $('.comment-body').eq(index2).next().toggle();
  
          }
  
      });
  
  };
  </code></pre>
  
  <p>Why it doesn't work or how can I add a new div to clicked div below (as twitter reply)? Before I wrote some code. It was working but there was a problem: it was working for one div only.</p>