Home > Software engineering >  I am getting an ejs error saying - Could not find matching close tag for "<%"
I am getting an ejs error saying - Could not find matching close tag for "<%"

Time:06-14

I have checked the internet about potential causes like nested tags. There were before but I have removed them. Some place users have actually forgotten to close the tag, but I checked manually each tag but and every opening tag has a closing tag.

There are some if-else statements and one loop. I checked the syntaxes for using loops and if-else statements and made the syntaxes as saw on the internet.

Still, I am getting this issue. Here is my Code.

      <header>
        <div >
          <img
            src=""
            width="160"
          />
          <%=Plant%>
        </div>
        <h3>
          <% if (GatePassType === "RGP") { %> RETURNABLE GATE PASS <% } else {
          %> NON RETURNABLE GATE PASS <% } %>
        </h3>
      </header>
      <div >
        <div >
          <div >
            <p>Gate Pass No</p>
            :
            <p><%=GatePassNo%></p>
          </div>
          <div >
            <p>Issued By</p>
            :
            <p><%=DepartmentName%></p>
          </div>
        </div>

        <div >
          <div >
            <p>Gate Pass Date</p>
            :
            <p><%=GatePassDate%></p>
          </div>
          <div >
            <p>Issued To</p>
            :
            <p><%=PartyName%></p>
          </div>
        </div>
      </div>
      <table>
        <tr>
          <th>Item Name</th>
          <th>Unit</th>
          <th>Out</th>
          <% if (GatePassType === "RGP") { %>
          <th>Exp Ret. Date</th>
          <% } %>
          <th>Purpose</th>
        </tr>
        <% for(let i = 0; i < Items.length; i  ) { %>
        <tr>
          <td><%= Items[i].ItemCode Items[i].ItemName %></td>
          <td><%= Items[i].Unit %></td>
          <td><%= Items[i].Quantity%></td>
          <% if (GatePassType === "RGP") { %>
          <td><%=Items[i].ReturnDate%></td>
          <% } %
          <td><%= Items[i].Remarks %></td>
        </tr>
        <% } %>
      </table>
      <footer>
        <p>
          N.B.: Carrier to be produce his copy at security office while
          returning the material to the factory.
        </p>
        <div >
          <p><%=InitiatorEName%></p>
          <p><b>Initiated By</b></p>
          <br />
          <p><%=ApproverEName%></p>
          <p><b>Authorized By</b></p>
        </div>
        <div >
          <p><%=CarrierString%></p>
          <p><b>Carrier Name</b></p>
          <br />
          <p><%=MainGateEname%></p>
          <p><b>Security By</b></p>
        </div>
      </footer>
   

CodePudding user response:

I think that it would be easiest to post a screen shot. You are missing closing tag -> enter image description here

CodePudding user response:

You are missing a > in this part:

<% if (GatePassType === "RGP") { %>
    <td><%=Items[i].ReturnDate%></td>
<% } % <- HERE
  • Related