Unable to select id to set background-color

Unable to select id to set background-color

I am unable to set the background colors using a variable as a selector on id's that contain a space ' '  or  forward slash '/'.   Is there any way to accomplish this?  May be my escaping the spaces or forward slashes?

id='Income Range'                           Does not work
id='Debit Card Holder'                      Does not work
id=' Credit Card Holder'                    Does not work
id='Credit Risk'                                Does not work
id='Excellent Credit'                         Does not work
id='Good Credit'                               Does not work
id='nvestments/Retirement Plans'      Does not work
id='Retail Card Holder'                      Does not work
id='Wealth'                                      Works!!!

var str = "<div  class='segments' id='" + mSegment[i] + "' style=' position:absolute; top:" + vpos + "px'><table border='0' width='100%' height='100%'><tr><td valign='middle' align='center'><b><font face='Arial' size='3'>"+  mSegment[i]  + "</font></b></td></tr></table></div>"        
$("#segments-area").append(str);   
          
if( isSelected( mCatID, mSegment[i]) )
{
    $( "#"  + mSegment[i] ).css("background-color","orange");
}else{
     $('#' + mSegment[i] ).css("background-color","white");
}

Any help would be great