Skip to content

People can play without a name. validation only works when people start writing #9

@Gabriel-Aroucas

Description

@Gabriel-Aroucas

One method to resolve this is to place the action of removing the button styles in a function and placing it as "onload" in the "body" of the html.

<body onload="removeButton()"> // ....
const validateInput = ({ target }) => {
  if (target.value.length > 3) {
    button.removeAttribute('disabled');
    return;
  }

// **** here****
  removeButton()
}

// ***** Here *****
const removeButton = () => {
  button.setAttribute('disabled', '');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions