Domanda

I tried to pass textbox as a parameter in each render. and tried following,

in controller,

res.render('index', { dynamic_textbox: '<input type="text" value="test" />' });

and in index.ejs,

<%= dynamic_textbox %>

It displaying result as a string not textbox..

Please any one..

È stato utile?

Soluzione

EJS autoescapes output by default. The following will be escaped:

<%= dynamic_textbox %>

You need to use this syntax instead, if you want to output raw HTML:

<%- dynamic_textbox %>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top