jeudi 2 juin 2016

JQuery if condition

I have this jQuery code which I want it to run in a given condition. Now I have 2 strings file and stat and I want to run a block of code only if both of them are not empty. That means one can be empty and both of them can be filled but 2 of them mustn't be empty so I ran this:

if((stat !== "") || (file !== "")) {
    console.log("good");
}

But the code doesn't run until I fill in both fields. I also changed the OR to && and still same result. Is it that || and && give the same command or is there any better way to achieve this?

Aucun commentaire:

Enregistrer un commentaire