Skip to content

Instantly share code, notes, and snippets.

@mason-stewart
Last active December 14, 2015 01:38
Show Gist options
  • Select an option

  • Save mason-stewart/5007233 to your computer and use it in GitHub Desktop.

Select an option

Save mason-stewart/5007233 to your computer and use it in GitHub Desktop.
// Needs an extra closure (not shown)
mode = {a: 'foo', b:'bar', c:'baz'}
for (var key in mode) {
$('#' + key).change(function() {
if ($(this).is(':checked')) {
mode[key] = true;
}
else {
mode[key] = false;
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment