I am trying to require a password to end an event and go back to the login page, but when I click the button nothing happens.
The function and button I am using are below. Note this is below the end of the form I am using to submit on to the next page.
<button id="exitBtn">End Event</button>
<script>
var exitBtn = document.getElementById("exitBtn");
exitBtn.addEventListener("click", password());
function password() {
var realPW = "<?php echo $pw ?>";
var pword = prompt("Please enter your password:");
if (realPW == pword) {
self.location = "LoginBox.php"
}
</script>