Javascript function only alert Me [closed]

Try return false; from within the if statement.

    if(pass1.value != pass2.value)
    {
        alert("don't match");
        return false; // Abort
    }

Also as @Lloyd said, check for values, not elements.

Leave a Comment