ejs icon indicating copy to clipboard operation
ejs copied to clipboard

Help! I am Using Vs code and it doesn't recognize ejs tags.

Open fatajomustapha10 opened this issue 5 years ago • 1 comments

I am Using Vs code it doesn't recognize ejs tags when they are inside an html tag like the input tag below :

<input type="checkbox" name="checkbox" value="<%=item._id%>" onChange="this.form.submit()"> Before changing the default value property from on to <%=item._id%> it would actually print on, Now it does nothing ! and in the code itself i can see that it doesn't recognize it because the color doesn't change as usual.

Any suggestion is appreciated.

fatajomustapha10 avatar Jul 08 '20 20:07 fatajomustapha10

After much trial and error(a day and a half to be precise) I used this <%- instead of <%= and it worked. According to the documentation this <%- tag outputs unescaped value into template. See full code below:

value='<%-item._id%>' <input type="checkbox" name="checkbox" value="<%-item._id%>" onChange="this.form.submit()"> and I have a clue of how that worked but if any one can give me a comprehensive explanation that would be greatly appreciated. I would love to understand completely these how this tag works.

fatajomustapha10 avatar Jul 09 '20 16:07 fatajomustapha10