0

I have a function from which i d like to return a small html snippet.

in the page.ejs <% for(var i=0; i < studentList.length; i++) { %>

                <td> <%= rateStudent(studentList[i].metricArray)%> </td>

            </tr>
        <% } %>
</tbody>

somewhere in the page.js

function rateStudent(metricArray){
     // omitted

        return '<span class="label label-danger"> Zayif </span>';
    };

the function is called, everything works. But the function returns the snippet and i see it printed as text :) is it normal?

how can i return a div snippet from a ejs function?

<span class="label label-danger"> Zayif </span>

Thanks

Orkun Ozen
  • 6,665
  • 7
  • 53
  • 86

0 Answers0