0
<!DOCTYPE html>
<html>
  <head>
    <title>ToDo List</title>
    <link rel="stylesheet" href="css/style.css" />
    <meta charset="utf-8" />
  </head>
  <body>
    <div class="box">
      <h1>Todo List</h1>
    </div>
    <div class="box2">
      <!--<% for(var i=0; i< dayej.length; i++ ) { %>-->
      <% dayej.forEach(function(items){ %>
      <form action="/delete" method="POST">
        <div class="item">
          <input
            type="checkbox"
            value="<%= items._id %>"
            name="checkbox1"
            onchange="this.form.submit()"
          />
          <!-- <p><%= dayej[i].name%></p>-->
          <p><%=items.name%></p>
        </div>
      </form>

      <% }) %>

      <form class="item" action="/" method="POST">
        <input type="text" name="ele1" placeholder="Enter the task" />
        <button type="submit">+</button>
      </form>
    </div>
  </body>
</html>

TO delete the elements and without giving any errors its a todo list where I want to delete and add elements is list so that it can be given and thus running a for loop for each of it

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • 1
    There's no `catch` anywhere in the code you posted. The error is coming from something else. – Barmar Jun 13 '23 at 15:53

1 Answers1

0

please you should review the JavaScript code within your template and check for any syntax errors. The specific error "Unexpected token 'catch'" might indicate an issue with the usage of a try-catch block or a similar construct in your code.

  • Please add more details. The code is OK but we need more information regarding your problem in general. – AztecCodes Jun 16 '23 at 17:40
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 16 '23 at 17:40