Semicolon Fingers
++ + | ++ + | ++ + | +
+ + | ++ + | ++ + | +
+ + | ++ + | ++ + | +
diff --git a/functional.js b/functional.js index e69de29..cca2d41 100644 --- a/functional.js +++ b/functional.js @@ -0,0 +1,17 @@ +const ids = ["a1", "a2", "a3", "b1", "b2", "b3", "c1", "c2", "c3"]; + +document.onclick = function (event) { + + const { target } = event; + const { id } = target; + + if (ids.includes(id)) { + const box = document.getElementById(id); + box.classList.add('clicked'); + box.classList.remove('unclicked'); + document.addEventListener('click', function() { + box.classList.add('unclicked'); + box.classList.remove('clicked'); + }, true); + } +} diff --git a/index.html b/index.html index e073445..3ed8c0d 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@
Ini adalah halaman home
-- -
-- -
-- -
-+ + | ++ + | ++ + | +
+ + | ++ + | ++ + | +
+ + | ++ + | ++ + | +