As the title very well suggests, I have a checkbox in Javascript, or more like HTML. I have added an Event Listener for mouse down like so:
const checker = document.getElementById("clicker")
const maincheck = document.getElementById("maincheck")
checker.addEventListener("mousedown", function(){
if(event.button == 0){
console.log("Ok")
console.log("I am here")
flareup.style.display = "block"
}
if(event.button == 1){
maincheck.className = "animationclass"
console.log("Is")
}
})
When I left click it, it works perfectly fine - like a charm. But when I right click it, That's where problems arise. After left clicking it, when I right click it, nothing happens. I even added a check to print something in that instance and that corroborated my suspicion of nothing happening. I am not sure what's going on. I would appreciate help!
I don't know if this would help but fo context's sake here is the HTML:
<!DOCTYPE html>
<html>
<head>
<title>The Verification Game</title>
<link rel="stylesheet" href="./starting.css"></link>
</head>
<script src="https://kit.fontawesome.com/1f2023aaf1.js" crossorigin="anonymous"></script>
<body>
<div id="underneath">
<h2>Are you a human?</h2>
<input type="checkbox" id="realclicker"></input>
</div>
<div id="maincheck">
<h2>Are you a robot?</h2>
<input type="checkbox" id="clicker"></input>
</div>
<div id="incorrect">
<div id="inner">
<h1 class="fancytext">So you are a robot? You can't come here.</h1>
</div>
</div>
<script src="verification.js"></script>
</body>