просто изменить
$("input[type='checkbox']").is(':checked')
на
$("input", this).is(':checked')
и
$('label.boxextra').css('background-color', 'red');
на
$(this).css('background-color', 'red');
$(document).ready(function() {
$('label.boxextra').each(function() {
$(this).click(function() {
if ($("input", this).is(':checked')) {
$(this).css('background-color', 'red');
} else {
$(this).css('background-color', '#fff');
}
});
});
});
label.boxextra {
background: #fff;
border: 1px solid #D4D4D4;
padding: 10px;
color: #000000;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<label for="extra_0" style="display:inline; margin-right: 10px;" class="boxextra"><input type="checkbox" data-multiple="1" id="extra_0" name="extra[]" value="rosii"> rosii</label>
<label for="extra_1" style="display:inline; margin-right: 10px;" class="boxextra"><input type="checkbox" data-multiple="1" id="extra_1" name="extra[]" value="castraveti"> castraveti</label></td>