如果选中输入,则更改标签的bg颜色

Hello i have a while loop selecting elements from database and i display them as label input. What i want to achive is to change background-color if element is checked. Here is my code but it's not working.

html
<label class="m1">
<input class="table" type="checkbox" value="1"  name="masa[]" class="checkbox" >
</label>

<label class="m1">
<input class="table" type="checkbox" value="2"  name="masa[]" class="checkbox" >
</label>

<label class="m1">
<input class="table" type="checkbox" value="3"  name="masa[]" class="checkbox" >
</label>

<label class="m1">
<input class="table" type="checkbox" value="4"  name="masa[]" class="checkbox" >
</label>

js

<script type="text/javascript">
$('.m1').live('click', function() {

        var elem = $(this).find('input:checkbox');

        $('input:checkbox:checked').parent('label').css('background-color', '#B6BF34');

        if( elem.is(':checked') && elem.is(':enabled') ) {
            $(this).css('background-color', '#00B0EA');
        }

    });
</script>

Try this:

$('.table').change(function(){
  var c = this.checked ? '#00B0EA' : '#B6BF34';
  $(this).parent().css('background-color', c);
});

Working Demo