Created
April 17, 2012 10:30
-
-
Save salieridk/2405159 to your computer and use it in GitHub Desktop.
Javascript: Check all checkboxes (button)
This file contains 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
$('#checkIt').click(function() { | |
if(this.value === 'notChecked'){ | |
$('#educationCheckbox :checkbox').each(function() { | |
this.checked = true; }); | |
$('#checkIt').val('checked').html('Fjern alle'); | |
} | |
else{ | |
$('#educationCheckbox :checkbox').each(function() { | |
this.checked = false; }); | |
$('#checkIt').val("notChecked").html('Vælg alle'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment