I have this table that I echoed in a page I'm making, and in the output is a series of products separated by a comma (,)
Here is the code for the column:
<td class='listord'>" . $row["OrderList"] . "</td>
here is a sample ouput:
PRODUCT1,PRODUCT2,PRODUCT3
expected output:
PRODUCT1
PRODUCT2
PRODUCT3
This is my current code but it doesn't seem to work:
let str = document.getElementsByClass("listord");
for (var i = 0; i < str.length; i++) {
let result = str[i].innerText.replace(/,/g, "<br>");
str[i].innerText = result;
}
What am I doing wrong?