I'm trying to make a win condition, that if these three specific classes have been added to my h1 "tester", it alerts something. For some reason, the function is not working. It doesn't actually check if it contains any of the classes, and alerts the message either way.
Does anybody know why it's doing this, or what i'm doing wrong? Here's my code:
var diagonalRightX = ["CX", "EX", "GX"];
function winTester() {
if (document.getElementById("tester").classList.contains=("CX")) {
alert(diagonalRightX);
}
}
<h1 id="tester" onclick="winTester()" class="CX, EX, GX">Click Me!</h1>