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.
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.

```