Moved code into function
This commit is contained in:
parent
2e0bc3764f
commit
07a34b1b12
|
@ -29,6 +29,14 @@ function checkCount() {
|
|||
return false;
|
||||
}
|
||||
|
||||
function check(choice) {
|
||||
value = checkedGroups[0];
|
||||
removeId();
|
||||
getid = choice+value;
|
||||
document.getElementById(getid).checked = true;
|
||||
checkCount();
|
||||
}
|
||||
|
||||
window.addEventListener("keydown", function (event) {
|
||||
if (event.defaultPrevented) {
|
||||
return;
|
||||
|
@ -40,18 +48,10 @@ window.addEventListener("keydown", function (event) {
|
|||
|
||||
switch (event.key) {
|
||||
case "a":
|
||||
value = checkedGroups[0];
|
||||
removeId();
|
||||
getid = 'a'+value;
|
||||
document.getElementById(getid).checked = true;
|
||||
checkCount();
|
||||
check("a");
|
||||
break;
|
||||
case "b":
|
||||
value = checkedGroups[0];
|
||||
removeId();
|
||||
getid = 'b'+value;
|
||||
document.getElementById(getid).checked = true;
|
||||
checkCount();
|
||||
check("b");
|
||||
break;
|
||||
default:
|
||||
checkCount();
|
||||
|
|
Loading…
Reference in New Issue