Last active
December 14, 2015 16:08
-
-
Save jaredhabeck/5112683 to your computer and use it in GitHub Desktop.
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
// Make sure you have a parent element that wraps the checkboxes you want to check has an ID set | |
// in this case it's "interest" - so <fieldset id="interest">. | |
$('#checkall').click(function(e) { | |
e.preventDefault(); | |
$('#interest').find('input[type="checkbox"]').each(function(item) { | |
if ($(this).attr('checked')) { | |
$(this).attr('checked', false); | |
} else { | |
$(this).attr('checked', true); | |
} | |
var target = $(this).next('label').attr('for'); | |
if (document.getElementById(target)) { | |
populateField(target); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment