Django. How can I edit the text received from the database using HTML?
I have a database that stores the text. I uploaded this text to the database as a list. I need this text to be displayed on the page in the same way as a list, but it is displayed as a string. I tried to connect javascript and use a loop to track ';' and write '\n' instead. The code itself worked fine, but when I started getting an element with my text using getElementById, I ran into a problem: I get a lot of text: aligntitlelangtranslatedirhidden... etc.
My JS code:
function textTab(){
let text = document.getElementById('specsText');
let newText = '';
for(let el in text) {
if (el === ';'){
newText += '\n';
} else{
newText += el;
};
};
console.log(newText);
text.innerHTML = newText;
};
textTab()
I am a beginner, so I apologize in advance for the possible inaccuracy of the question or errors in the code