I have an apps script that dynamically creates content from a Google Sheet, loading content into Bootstrap grid components.
While the code does work correctly, I need to cater for multiple rows, explained below.
A simplified version of the code is:
<? for (var i=0 ; i <lastRow; ++i) { ?>
<?if(getNSW[i] != "" && getNSW[i] != "TOTAL") {?>
<div class="col-md-4">
<!-- output -->
</div>
</div><? }} ?>
What I am aiming to do is for every 3rd col div created, to put them in a new "row" div.
Output would be something like:
<div class="row">
<div class="col-md-4"><!-- content --></div>
<div class="col-md-4"><!-- content --></div>
<div class="col-md-4"><!-- content --></div>
</div>
<div class="row">
<div class="col-md-4"><!-- content --></div>
<div class="col-md-4"><!-- content --></div>
<div class="col-md-4"><!-- content --></div>
</div>
Obviously I need some sort of for loop to count the cols etc... I am just drawing a blank for the correct syntax.