Is there anyway to do a form validation where the user has to type in a specific word or set of characters to get to the next page?

I am trying to make a pseudo password just for looks and I was wondering if what I am trying to do is even possible with HTML and JavaScript
Here is the code I am using:
HTML:

Login

JavaScript:
const password = document.getElementById(“password”).value;

const confirmPassword = document.getElementById(“confirm-password”).value;

if (password.value !== confirmPassword.value) {

alert(“Entered passwords do not match”);

} else {

}

Thanks in advance to anyone who can help me.

Yes, its mostly possible with HTML and JavaScript. (Although authentication is usually handled by a server.)
That code looks correct to me.
But you’ll probably need to put it inside a function that’s being used for an event listener.