Created
August 13, 2021 21:50
-
-
Save asllanmaciel/18e951942e7a9e20e3d11c9c093b1ff4 to your computer and use it in GitHub Desktop.
Check All and Other with jQuery
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
$(document).ready(function() { | |
//See working in https://jsfiddle.net/asllanmaciel/qw5zj7an/4/ | |
//check all checkboxes (array) except element ".outras" | |
$('input.all[name=tratamento_doencas\\[\\]]').click(function() { | |
$('input[name=tratamento_doencas\\[\\]]').not(this).not('.outras').prop('checked', this.checked); | |
}); | |
//hide container | |
$('.tratamento_outras').hide(); | |
//Toggle visibility | |
$('input.outras[name=tratamento_doencas\\[\\]]').change(function(ev) { | |
var t = ev.target | |
$('.tratamento_outras').toggle(500, function() { | |
$('input.outras[name=tratamento_doencas\\[\\]]').not(this).prop('checked', this.checked); | |
}); | |
return false; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See in https://jsfiddle.net/asllanmaciel/qw5zj7an/4/