diff --git a/public/js/checkboxlocalstoragebackground.js b/public/js/checkboxlocalstoragebackground.js index 9915185..a8b209e 100644 --- a/public/js/checkboxlocalstoragebackground.js +++ b/public/js/checkboxlocalstoragebackground.js @@ -2,7 +2,7 @@ var checkboxes = document.querySelectorAll('.govuk-checkboxes__input'); checkboxes.forEach(function (i) { i.addEventListener('click', clickFunc); - if(sessionStorage.hasOwnProperty(i.value)){ + if(sessionStorage.hasOwnProperty(i.value + '-background')){ i.checked = true; } }) @@ -11,8 +11,8 @@ function clickFunc() { if(this.checked){ sessionStorage.setItem(this.value + '-background', this.value); } else { - if(sessionStorage.hasOwnProperty(this.value)){ - sessionStorage.removeItem(this.value); + if(sessionStorage.hasOwnProperty(this.value + '-background')){ + sessionStorage.removeItem(this.value + '-background'); } } } \ No newline at end of file diff --git a/public/js/checkboxlocalstorageresources.js b/public/js/checkboxlocalstorageresources.js index f0b37fa..7e5e382 100644 --- a/public/js/checkboxlocalstorageresources.js +++ b/public/js/checkboxlocalstorageresources.js @@ -2,7 +2,7 @@ var checkboxes = document.querySelectorAll('.govuk-checkboxes__input'); checkboxes.forEach(function (i) { i.addEventListener('click', clickFunc); - if(sessionStorage.hasOwnProperty(i.value)){ + if(sessionStorage.hasOwnProperty(i.value + '-resource')){ i.checked = true; } }) @@ -11,8 +11,8 @@ function clickFunc() { if(this.checked){ sessionStorage.setItem(this.value + '-resource', this.value); } else { - if(sessionStorage.hasOwnProperty(this.value)){ - sessionStorage.removeItem(this.value); + if(sessionStorage.hasOwnProperty(this.value + '-resource')){ + sessionStorage.removeItem(this.value + '-resource'); } } } \ No newline at end of file