Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
List items are not shown as well as can't add new items in list dynemically

these code is not allowing me to add new item into the list as well as already added list items are not showing. the button symbol is not displaying. list.ejs To Do List

<%= listTitle %>

    <% for(var i=0;i<=newListItems.length; i++) %> <% { %>

    <%= newListItems[i] %>

    <% } %>
<button type="submit" name="button" value=<%= listTitle %>+ app.js const express = require("express"); const bodyParser = require("body-parser"); const app = express(); let items =["Buy Food","Cook Food","Eat Food"]; let workItems=[]; app.set('view engine','ejs'); app.use(bodyParser.urlencoded({extended:true})); app.use(express.static("public")); app.get("/", function(req, res){ let today = new Date(); let options={ weekday:"long", day:"numeric", month:"long" }; let day=today.toLocaleDateString("en-US",options); res.render("list",{listTitle:day , newListItems:items}); }); app.post("/",function(req,res){ let item = req.body.newItem; if(req.body.list === "Work"){ workItems.push(item); res.redirect("/work"); } else{ items.push(item); res.redirect("/"); } }); app.get("/work",function(req,res){ res.render("list",{listTitle:"Work List", newListItems:workItems}); }); app.listen(3000, function(){ console.log("Server started on port 3000."); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  <%= listTitle %>     
 <% for(var i=0; i < newListItems.length; i++) %>
            <% { %>
                <%= newListItems[i] %>

                    <% } %>
          <form action="/" method="POST">
              <input type="text" name="newItem">
              <button type="submit" name="button"><%=listTitle %></button>
          </form>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!