Pergunta

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

Foi útil?

Solução

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 %>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top