Skip to content

Instantly share code, notes, and snippets.

@joshualambert
Created November 21, 2012 22:03
Show Gist options
  • Save joshualambert/4128161 to your computer and use it in GitHub Desktop.
Save joshualambert/4128161 to your computer and use it in GitHub Desktop.
Switch loop
followMeSwtichCheckbox.eventOverride = false;
followMeSwtichCheckbox.addEventListener('change', function(e) {
if (followMeSwtichCheckbox.eventOverride == false) {
if (checkSOSactive() == false) {
alert('SOS inactive.');
} else {
followMeSwtichCheckbox.eventOverride = true;
if (followMeSwtichCheckbox.value == true) {
followMeSwtichCheckbox.value = false;
} else {
followMeSwtichCheckbox.value = true;
}
alert('SOS active.');
followMeSwtichCheckbox.eventOverride = false;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment