Last active
October 23, 2015 21:01
-
-
Save sharpmachine/35f6231e8afc23ac5735 to your computer and use it in GitHub Desktop.
This script creates a checkbox option for users to select all the answers in the good column
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var firstRadio = $('.tdNsgAnswerContainer:first-child input[type="radio"]'); | |
| var selectAllGood = [ | |
| '<div class="NsgQuestionContainer" style="padding-left: 20.8em">', | |
| '<label>', | |
| '<input type="checkbox" id="selectAllGood">', | |
| 'Select All Good', | |
| '</label>', | |
| '</div>' | |
| ].join(' '); | |
| function isAllChecked(trueOrFalse) { | |
| $('.tblNsgAnswersContainer').each(function() { | |
| firstRadio.prop( 'checked', trueOrFalse ) | |
| .trigger('change'); | |
| }); | |
| } | |
| $('.NsgQuestionContainer').first().before(selectAllGood); | |
| $('input#selectAllGood').change(function() { | |
| if(this.checked) { | |
| isAllChecked(true); | |
| } else { | |
| isAllChecked(false); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment