Question

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..

Était-ce utile?

La solution

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 %>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top