From 2e5125c2982e2da8446c0a1ddd83e3816e48fdc6 Mon Sep 17 00:00:00 2001 From: adrien Date: Tue, 17 Oct 2023 23:33:39 +0200 Subject: [PATCH] uncheck radio if clicked twice --- js/sudoku.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/js/sudoku.js b/js/sudoku.js index b6be6df..bf7fab5 100755 --- a/js/sudoku.js +++ b/js/sudoku.js @@ -310,9 +310,15 @@ function onmouseleave(event) { } function insert(radio) { - valueToInsert = radio.value - grid.style.cursor = valueToInsert ? "copy" : "text" - highlight() + if (radio.value && valueToInsert == radio.value) { + radio.blur() + insertRadio0.checked = true + insert(0) + } else { + valueToInsert = radio.value + grid.style.cursor = valueToInsert ? "copy" : "text" + highlight() + } } function undo() {