Apply background color to multiple td's when its id is known

Apply background color to multiple td's when its id is known

Hi all,

I have a jquery function which gets the id value of td's whose checkboxes are checked.
I need to color those td's. I have written this function which does not give me any error but does not color the td's also..

Here is the function:
$('#custom-interval-tbl td').each(function() {
 $(this).find('input:checkbox:checked').each(function() {      
    var tdId= $(this).attr("id");
    var tdElement = $("#custom-interval-tbl td").eq(tdId); 
    console.log("D Element"+tdElement);        
    tdElement.css({background:"#333333"});
    });
});

Here is the console.log output:

tdId =>mon_1
TD Element[object Object]
tdId =>wed_4
TD Element[object Object]
tdId =>wed_5
TD Element[object Object]
tdId =>sun_0
TD Element[object Object]

Can someone please tell me what mistake am I doing?

Thanks for your help.