Question: * If i do `password1.lenghth` in `if()` and test the lenght it still
displays that passwords are shorter than 5.
* I'm still in school so we are doing simple stuff that might seem
obvious but are not to me.
* Also tried putting `var pass_lenght= password1.lenght;` and `var
pass_lenght= document.getElementById("password1").lenght;` didn't
work Anyone knows why?

Thanks

```
    var password1= document.getElementById("password1");
    var password2= document.getElementById("password2");
    password1.addEventListener("blur",function()
    {

        if (password1!= password2) {     
            password1.setAttribute("class","wrong");
            password2.setAttribute("class","wrong");
            return false;
            } 

            else if(password1.lenght<5)
            {
            password1.setAttribute("class","wrong");
            return false;

            }
            else
            {
            password1.setAttribute("class","correct");
            }
    });

    password1.addEventListener("blur",function()
    {

        if (password1!= lozinka2) {     
            password1.setAttribute("class","wrong");
            password2.setAttribute("class","wrong");
            return false;
            } 

            else if(password2.lenght<5)
            {
            password2.setAttribute("class","wrong");
            return false;
            }
            else
                {
            password2.setAttribute("class","correct");
        }
    });

```

Answer: 
What seems to be the problem is that you are not actually accessing the length. Your `getElementById` does exactly what it says, get an **element** by id. But you want the value entered, not the element.

```
You: password1.length
Correct: password1.value.length

```

Also, even if you change that, the `else if` statement wouldn't even be reached, so that would be pointless.

So, *only change* the `password1` and `password2` variables to:

```
var password1= document.getElementById("password1").value;
var password2= document.getElementById("password2").value;

```
You normally measure the length of an input field but you can never measure the length directly off an element. You will have to get the value of input field by:

```
var password1= document.getElementById("password1").value;

console.log(password1.length) //======> this will print the length.

```