Kevin Powell - CommunityKP-C
Kevin Powell - Communityβ€’3y agoβ€’
17 replies
CDL

Trying to add a minlength requirement to a DOM created html node - issues

Hey peeps, me again.

Before i go into this, can I ask to the experienced devs, is creating a todo list where you have projects, and then tasks to be added/removed inside those projects with dates etc... is that difficult? because I am STRUGGLING massively with building this, and I feel like it should be easier.

Anyway here's my up-to-date code: https://github.com/callum-laing/todo-list

What I'm trying to do is have button to add new projects - a text field, a confirm button and a X to cancel the creation.

So far it seems the buttons work at least and I can add project names.. however the minlength method is not working, so I can add a project with no name, or with 1-2 letters etc.. basically anything. Right now I'd settle for it forcing you to enter at least 1 character, so throwing up an error if you enter nothing.

the original code for this before I changed it all to createElement/append etc is below:

    <div class="newProject">
                <form action="">
            <input type="text" id="newProjectText" required minlength="3">
            <button id="confirmProject">Confirm</button>
            <button id="cancelProject">X</button>
          </form>
      </div>`;


Send help.
GitHub
Contribute to callum-laing/todo-list development by creating an account on GitHub.
GitHub - callum-laing/todo-list
Was this page helpful?