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: 
There are some flaws in the above code which are as follows:

1. If you want the actual text you should use the `value` attribute.

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

```

2. It might be because your spelling of `length` is wrong.
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;

```