Password validation error

I am making a basic login webpage for class project. I want to check the password and confirm password should match. If they are not same then it should give an alert message. But here I don’t get that error message. What have I done wrong here ? Please help !

i tried debugging your code, and I’m not exactly sure why the condition doesn’t execute, but check out the links above. In the first I was able to get the desired functionality with less code.

In the second, I changed your code around some and was able to get the alert to show.