[Solved] How do you repeat similar elements multiple times with different content using Bootstrap?


Use JavaScript to create multiple HTML elements with the same classList. It’s now up to you to adapt this for your context:

const $root = document.getElementById('root')

const data = ["foo", "bar", "naz"]

for (var i = 0; i < data.length; i++) {
  var newEl = document.createElement('p')
  newEl.classList="data-item"
  newEl.innerText = data[i]
  $root.appendChild(newEl)
}
.data-item {
    font-family: sans-serif;
}
<div id="root"></div>

solved How do you repeat similar elements multiple times with different content using Bootstrap?