I wish to append new divs between already existing divs as shown in example.
<div id='container1'>Some contents</div>
<div id='container2'>Some contents</div>
<div id='container3'>Some contents</div>
<div id='container4'>Some contents</div>
<div id='container5'>Some contents</div>
Now suppose I wish to append something after container 4 but before container 5 using AJAX.
How, can this be done using Javascript ??
.append in Jquery inserts content, specified by the parameter, to the end of each element in the set of matched elements.
Or use .before. It will prepend the new div to existing div.
See this demo.