Spacenil
  • Laravel
  • Node.js
  • PHP
  • React.js
  • JavaScript
  • C++
  • MySQL

How to use if statement in ejs? 1

Express.js
Viewed 2587 times
Aug 04,2022
Active

 

You can use if else in ejs by putting html code inside it. Example:

 

 

<% if(status==1){ %>

<p>This is success message</p>

<%  } else{  %>

<p>This is error message</p>

<% } %>


  • RELATED POSTS
  • How-to use-if-statement-in-ejs How to use if statement in ejs?
  • Error-bcrypt-is-not-defined-after-clicking-submit-button-in-registration-page Error "bcrypt is not defined" after clicking submit button in the registration page
  • How-to-add-css-file-to-ejs-Express-js How to add css file to ejs Express js
  • How-to-install-EJS-view-template-engine-in-express-js-Node-project How to install EJS view template engine in express.js Node project?
  • How-to-install-express-js-in-a-node-project How to install express.js in a node project?

    • NEW POSTS
    • How to use if statement in ejs New
    • Error bcrypt is not defined after clicking submit button in registration page New
    • How to add css file to ejs Express js New
    • How to install EJS view template engine in express js Node project New
    • How to install express js in a node project
    • About Us
    • Privacy Policy
    Copyright © 2023 Spacenil. All rights reserved.