Skip to content

Instantly share code, notes, and snippets.

@awhedbee22
Created December 10, 2014 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awhedbee22/3c227f8e7bcd1637fa0a to your computer and use it in GitHub Desktop.
Save awhedbee22/3c227f8e7bcd1637fa0a to your computer and use it in GitHub Desktop.
setTimeout(function () {
var forEach = function (array, callback, scope) {
for (var i = 0; i < array.length; i++) {
callback.call(scope, i, array[i]); // passes back stuff we need
}
};
var highRiskCheckboxValidator = function () {
var numberOfCheckBoxesChecked = $(".high-risks input:checked").length; //number of checked boxes
if(numberOfCheckBoxesChecked >= 2) {//|| $("#Singled input").is(":checked")) {//greater than or = 2 or neosez checked
$('input#yes').prop('checked',true); //Enable input yes
} else if(numberOfCheckBoxesChecked < 2){// || $("#Singled input").is(":not(:checked)")) { //less than 2 or neosez unchecked
$('input#yes').prop('checked',false); //Disable input yes
$('input#no').prop('checked',true); //Enable input no
}
};
highRiskCheckboxValidator();
$(".high-risks input[type=checkbox]").on("click", highRiskCheckboxValidator); // checkbox click event handler
}, 10000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment