This commit is contained in:
Felix Pankratz 2022-07-05 21:02:43 +02:00
parent abb63bea7f
commit 6e28c4fd93

View File

@ -48,8 +48,14 @@ function generateTable() {
table.addEventListener('click', (ev) => { table.addEventListener('click', (ev) => {
if (ev.target.tagName.toLowerCase() == "td" ) { if (ev.target.tagName.toLowerCase() == "td" ) {
ev.target.style.borderColor = "green"; let cell = ev.target;
ev.target.style.backgroundColor = "green"; if (cell.style.borderColor == "green") {
cell.style.borderColor = "black";
cell.style.backgroundColor = "white";
} else {
cell.style.borderColor = "green";
cell.style.backgroundColor = "green";
}
} }
}); });
} }