1

I have a nodeJS-HTML application. The html file accepts a form and calls nodeJS function which processes some data and send back some info to the hrml file. I am using views to render the details that need to be posted.

My app.js has this line of code

res.render('index.ejs', { collection: data})

where data is in the JSON format

"Name": "Chegg",
"Description" : "In February 2018, the diet and exercise service <a href=\"https://abc/FAQ.html\" target=\"_blank\" rel=\"noopener\">ABC suffered a loss</a>.

My index.ejs looks like this

<% for(var i=0; i<collection.length; i++) {%>
                    <div>
                     <p align="left"><%= collection[i].Domain %> </p> <br>
                     <p align="left"><%= collection[i].Description %> </p> <br>
                     <!-- <td><%= collection[i] %></td> -->
                    </div>
                  <% } 
%>

Here everything is populated correctly expect the Description. The links are not hyperlinked - but plain text.

Is there a way I can show the hyperlinks?

salt-pepper
  • 115
  • 3
  • 12

1 Answers1

0

As mentioned by @dimitristseggenes hyperlinks works with - but not with =

Change

<%= collection[i].Description %>

To

<%- collection[i].Description %>
Hemadri Dasari
  • 32,666
  • 37
  • 119
  • 162