Hi,
Instead using id use class name of your password text box
var input = document.getElementsByClassName("password text box");
var text = document.getElementById("capslock-message");
input[0].addEventListener("keyup", function(event) {
if (event.getModifierState("CapsLock")) {
text.style.display = "block";
} else {
text.style.display = "none"
}
});
Accepted answer is above but this is what i did for anyone in the future. I defined the class here in the properties and updated the code.
I also didnt have [0], in my original code which was why it was throwing an error :
document.getElementsByClassName("passwordBox")[0].addEventListener("keydown", function(event) {