Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I want this condition work to fill validation form for inputs

const userinfo = () => {
  // Trim -- remove spaces
  username = document.getElementById("username").value.trim();
  email = document.getElementById("email").value.trim();
  password = document.getElementById("password").value.trim();
  confirmpassword = document.getElementById("confirmpassword").value.trim();
  console.log(username, email, password, confirmpassword);
};
const checkinput = () => {
  // Not Null
  if (
    username.trim().length !== 0 &&
    email.trim().length !== 0 &&
    password.trim().length !== 0 &&
    confirmpassword.trim().length !== 0
  ) {
    return true;
  } else {
    // Style Java
    // Element.style.typeof style(Border, Size, Font, Color)
    msgPassword.style.border = "2px solid red";
    msgConfirm.style.border = "2px solid red";
    document.getElementById("error-allength").innerHTML =
      "place fill all filed ";
    return false;
  }
};

I want this condition work to fill validation form for inputs, I think it’s impoosible to solve it, please help me !!

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

const checkinput = () => {
  if (
    username.trim().length !== 0 ||
    email.trim().length !== 0 ||
    password.trim().length !== 0 ||
    confirmpassword.trim().length !== 0
  ) {
    return true;
  } else {
    
    msgPassword.style.border = "2px solid red";
    msgConfirm.style.border = "2px solid red";
    document.getElementById("error-allength").innerHTML =
      "place fill all filed ";
    return false;
  }
};
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading