jeudi 1 avril 2021

Am I doing something wrong? I’m trying to test if all fields are filled in and an API response isn’t invalid

  if (
  !document.getElementById("tousername").value.length == 0 &&
  !document.getElementById("fromusername").value.length == 0 &&
  !document.getElementById("frompassword").value.length == 0 &&
  !document.getElementById("subject").value.length == 0 &&
  !document.getElementById("message").value.length == 0 &&
  !data.username === undefined &&
  !data2.username === undefined) {
    alert("all good")
  }

I’m trying to test if all of the fields in the html web page is not empty, and if the 2 responses I get back from this API is not undefined. I want it to alert “all good” if these are all true. It just doesn’t work. Am I doing something wrong?

Aucun commentaire:

Enregistrer un commentaire