add dynamic field near his parent field?

Posted by Kaps Hasija on Stack Overflow See other posts from Stack Overflow or by Kaps Hasija
Published on 2012-09-06T12:13:25Z Indexed on 2012/09/26 9:38 UTC
Read the original article Hit count: 257

Filed under:

hi in my web page i am using Add Dynamic Field Functionality by using jquery. I am adding new div bu clicking on Existing div Like

<div class="divA">divA1 </div> 
<div class="divB" >DivB1 </div>
<div class="divC" />DivC1 </div> 

by clicking on parent div i am creating new daynamic div

<div class="divA">DivA2 </div>  

its coming end of the all div's like that

<div class="divA">divA1 </div> 
<div class="divB" >DivB1 </div>
<div class="divC" />DivC1 </div>
<div class="divA">DivA2 </div>  

But i need along with his parent div Like that

<div class="divA">divA1 </div> 
<div class="divA">DivA2 </div> 
<div class="divB" >DivB1 </div>
<div class="divC" />DivC1 </div>

any idea Thanks.

This is My Jquery Code

    newTextBoxDiv = $(document.createElement('div'))
     .attr("id", text).attr("class", 'test0 ' + text);
    newTextBoxDiv.html('<div style=" width:150px; class="DivA" float: left"> </div>'); 


}

newTextBoxDiv.appendTo("#contents");

contents is id of main div

© Stack Overflow or respective owner

Related posts about jQuery