I have code returning a list of results from my db (through a loop on front end), but I cannot seem to output a new line for each result that comes back.
<div id="names">
<% if(data.length){
for(var i = 0;i < data.length;i++) { %>
<p><%= data[i].FULLNAME %></p>
<% }
}else{ %>
<p>nothing</p>
<% } %>
</div>
<script>
var listOfNames = document.getElementById("names").innerText
console.log("list of names: " + listOfNames)
const words = [listOfNames] //I need to create new line after every name returned
the results basically come out like this:
name1 name2 name1
while I need them to come out like this:
name1
name2
name3
thanks for the help in advance