Refering to a live demo codepen at https://codepen.io/Maximusssssu/pen/MWrzpav. May I ask how can I toggle between 2 css class that is red square and red triangle represented below? When user click on triangle button, it will represent a triangle when grid is clicked and when click on square button it will be a square on grid when user click on it. Thank you for reading and have a nice day :)
<button onclick="triangle()">triangle</button>
<button onclick="square()">square</button>
.red-dot {
position:absolute;
width:15px;
height:15px;
background:red;
pointer-events: none;
}
.red-triangle {
position:absolute;
width:15px;
height:15px;
background:red;
pointer-events: none;
clip-path: polygon(50% 0, 100% 100%, 0 100%)
}