I'm trying to inject a string containing HTML elements into a div, but by the way, I only get it if the entire code is on one line.
This is what I am getting when push from the database and try to inject in div This is the problem
I tried to leave this code on one line and it worked This is how it should work
this is my code:
var html = <%=data.long_description%>
var html_string = html.replace("\n"," ")
console.log(html_string)
var iframe =document.getElementById("descript")
iframe.innerHTML = html_string
The only problem is that I am using innerHTML, as I will not be able to do all this manually. Does anyone know how fix/leave all / HTML code in one line?