Is there a way to render rich text format fetched from MySQL, inside of html page using Express (Node js)?

40 Views Asked by At

I have collected my html elements as product description. But when I fetch the data I cannot render it right away on page load. enter image description here

I have did a simple assign function

<script>
        function parseHTML(e){
            e.innerHTML = e.innerText
        }
    </script>

and set it to the page element as

        <td onload="parseHTML(this)" data-label="description"><%=item.description%></td>

but it doesn't work like this. Nevertheless it is working with onclick element

1

There are 1 best solutions below

1
J-J On

<%- outputs the unescaped value into the template in Express.