Skip to content

Commit

Permalink
function to allow people to click item name instead of just the check…
Browse files Browse the repository at this point in the history
…box > relates #52
  • Loading branch information
VirtualDOMinic committed Sep 21, 2018
1 parent 00f88dd commit 0356085
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ function forceChecked(e){
e.preventDefault();
window.alert("Please select at least one item to receive your results")
}
}
}

// Allow people to click on the label name to check or uncheck the checkbox
document.querySelector(".govuk-checkboxes").addEventListener("click", function(e) {
if(e.target.nodeName === "LABEL"){
e.target.previousSibling.previousSibling.click()}
})
2 changes: 1 addition & 1 deletion src/views/background.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@
</section>

<script src='js/checkboxlocalstoragebackground.js'></script>
<script src='js/force-checked.js'></script>
<script src='js/checkbox-improvements.js'></script>
2 changes: 1 addition & 1 deletion src/views/resources.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
</section>

<script src='js/checkboxlocalstorageresources.js'></script>
<script src='js/force-checked.js'></script>
<script src='js/checkbox-improvements.js'></script>

0 comments on commit 0356085

Please sign in to comment.