how to append a division to a division using jquery
<p>I'm trying to append a division to a division using <code>.append()</code> of  jquery. But my code is not appending the division.</p>

<p>My code is:</p>

<pre><code>    for(var k = 0,len=data.shareInfo.length;k&lt;len;k += 1){
    var newcommhtml = '&lt;div id="S0'+thecid+'" class="snew"&gt;';
    newcommhtml = newcommhtml + '&lt;div class="author-image"&gt;&lt;img src="data:image/jpeg;base64,'+data.shareInfo[k].senderPicture+'" alt="'+data.shareInfo[k].uname+'" width="100%" height="100%" class="ava"&gt;&lt;/div&gt;&lt;span&gt;'+data.shareInfo[k].uname+' shared the image '+data.shareInfo[k].imname+'&lt;/span&gt;';
    newcommhtml = newcommhtml + '&lt;div class="s-content"&gt;&lt;div class="s-message"&gt;&lt;span&gt;'+nl2br(data.shareInfo[k].message+'&lt;/span&gt;&lt;/div&gt;&lt;div class="shpicture"&gt;');
    newcommhtml = newcommhtml + '&lt;img src="data:image/jpeg;base64,'+data.shareInfo[k].image+'" alt="'+data.shareInfo[k].imname+'" width="100%" height="100%" data-id="'+data.shareInfo[k].id+'" data-alid="'+data.shareInfo[k].alid+'" data-shareid="'+data.shareInfo[k].shareId+'"&gt;';
    newcommhtml = newcommhtml + '&lt;/div&gt;&lt;/div&gt;';
    var thelm = "#S0"+thecid;
    $('#spscrl').append(newcommhtml);
    $(thelm).hide().fadeIn('slow');
    var newcommhtml=null;
    newcommhtml ='&lt;div class="SPcommentbox"&gt;';
    newcommhtml = newcommhtml + '&lt;div class="comment"&gt;&lt;div class="commenter-image"&gt;';
    newcommhtml = newcommhtml +'&lt;/div&gt;&lt;div class="commentername"&gt;';
    newcommhtml = newcommhtml +'&lt;/div&gt;&lt;div class="addcomment"&gt;&lt;input type ="text" placeholder="Write a comment..." class="commentbox"&gt;&lt;/input&gt;&lt;/div&gt;&lt;/div&gt;';
    var selector='#S'+thecid;
    $(selector).append(newcommhtml);
    thecid++;
    }
</code></pre>

<p>The code will able to append the <code>divs</code> to <code>#spscrl</code>. But it is not able to append to <code>selector</code> <code>(#S+thecid)</code>, If I try to add using <code>class</code> that is, <code>.snew</code> it append the <code>division</code>. <strong>Note that</strong> I'm adding the divs with jQuery...</p>

<p>Please anyone help me to solve this problem... Thanks...</p>
