diff --git a/Public/grid.js b/Public/grid.js index 51930e4..189f8c2 100644 --- a/Public/grid.js +++ b/Public/grid.js @@ -24,8 +24,7 @@ function getCapIdAtPosition(position) { return capPositions[position]; } -const selectedCapCircle = document.querySelector("#selected-cap-circle"); -const imageCanvas = document.querySelector("#image-canvas"); +const imageCanvas = document.getElementById("image-canvas"); var capPositions = Array.from( {length: numberOfCaps}, @@ -37,6 +36,7 @@ imageCanvas.innerHTML += capPositions.map(createImage).join(""); var selectedPosition = null; const elements = imageCanvas.getElementsByTagName("img"); +const selectedCapCircle = document.getElementById("selected-cap-circle"); imageCanvas.addEventListener("click", function(event) { const xPosition = event.clientX - imageCanvas.getBoundingClientRect().left;