Hi i want to select the div with a Class that have same name as my $id variable.
Everything is working if i add the div id by myself but i want it to be based on my $id variable.
Is this possible or is there a better way to target the right div based on the button that was clicked?
$('.checkbox-group').find('input[value=button]').click(function() { //find all buttons with value=button
var $toggle = $(this);
//add buttons in variable $toggle
var $id = $( this ).attr('id');
//add the clicked button´s ID in the variable $id
if ($toggle.prop('checked') === true) {
//if the clicked button is checked
$('#my-grp div.$id').removeClass('kill');
//want to select the div with Class that have same name as my $id variable
} else {
//and then add or remove the class .kill
$('#my-grp div.$id').addClass('kill');
}
});