How to set class for the selected checkbox?

Good time of day.

Could you tell me the site has a filter with a dropdown box which can be a field to enter numbers or checkboxes, as to do so would be to fill in or select the checkbox asked the class header filter(e.g. Brands) that would be possible to make it a different color?
I found an example but it works so sets the color of the selected checkbox.
$('body').on('click', '#js-control input:checkbox', function(){
 if ($(this).is(':checked')) {
$(this).parent().addClass('green');
 } else {
$(this).parent().removeClass('green');
}
});
June 14th 19 at 18:57
1 answer
June 14th 19 at 18:59
$(document).on('click', '#js-control input:checkbox', function(){
 var isChecked = $(this).is(':checked')
 $(this).parent().toggleClass('green', isChecked);
});

https://jsfiddle.net/czL277q5/

Find more questions by tags 1C-BitrixJavaScript