Home > Mobile >  Can I use data query in ejs inside html tag
Can I use data query in ejs inside html tag

Time:02-10

  <% tag.forEach(function(tag) { %>
    <div  style="color: <%=tag.fontcolor%>"><%= tag.name %> 
    <button  data-id="<%=tag.id%>">X</button></div>
  <% }) %>

I want to use tag.fontcolor for div style color but I have problem which appears in this next image:

property value expectedcss(css-propertyvalueexpected)

If you can give me a hint on how to solve this problem, that would be grateful.

CodePudding user response:

in EJS templating, for what is not text (attributes, class, ...), use the tag <%- instead of <%=

  • Related