In my jQuery code, I am appending images inside a div container. I need help adding a div class row when the column count reaches 12.
Any suggestions would be greatly appreciated. Thank you in advance!
for (var i = 0, j = result.images.length; i < j; i++){
$("#imageContent").append("<div class='col-md-3'><img src='storage/uploaded/" + result.images[i].name + "' class='img-responsive img-thumbnail'></div>");
}
Here is my current div structure:
<div class="container" id="imageContent" style="display: block;">
</div>
Current output:
<div class="container" id="imageContent" style="display: block;">
... (images here)
</div>
I want to add a Div class row when the column reaches 12 for the expected output:
<div class="container" id="imageContent" style="display: block;">
<div class="row">
... (first set of images here)
</div>
<div class="row">
... (second set of images here)
</div>
</div>