I'm trying to compare two passwords that a user will enter when trying to register but whenever a password is equal to that of the confirmed password is still throws the error passwords don't match. There's two stages to this if no password is entered then a error is presented that works fine, but the second stage comparing two password the errors is always true and presents it self.
if ($('#password').val() == "") {
$('.error').append("<li> Please enter a pasword </li>");
error = true;
} else if ($('#password') !== $('#password1')) {
$('.error').append("<li> You password does not match the confirmed password </li>");
error = true;
}