JAVASCRIPT
var $tables = $('#generate-here');
for (var i = 1; i <= 11; i++) {
var $folder = $('#folder_'+i);
$('<div />', { id: 'folder_'+i, class: 'grid_4'}).appendTo($tables);
$('<a />', { href: 'images/full'+i+'.jpg', class: gal_item'}).appendTo($folder);
};
HTML
<div id="generate-here">
<div class="grid_4">
<a href="images/full3.jpg" class="gal_item">
<img src="images/page2_img3.jpg" alt="">
<div class="gal_caption">
<time datetime="2014-01-01">01 Feb 16</time>
</div>
<span class="gal_magnify"></span>
</a>
</div>
</div>
i required above html DOM structure to be dynamically generated which i tried with above code but it is generating code just for grid_4 div and after the element not getting append.