Sunday, February 12, 2012

.color JQuery not working in Chrome/Safari


I have a piece of jquery which is working fine on firefox and ie but not working in chrome and safari



here it is




if (intCurrPortionId == intOldPortionId) {
$('#' + portionCell + '').css("backgroundColor", "green");
} else {
$('#' + portionCell + '').css("backgroundColor", "red");
}



and this is not working.. m calling this jquery on checkbox onchange event



EDIT: It is not executing the function in chrome and safari.. i added the alert in the code and found out that no alerts were popping... now how to tackle it

2 comments:

  1. $('#' + portionCell).css("background-color", "green");

    ReplyDelete
  2. Try using background-color:

    if (intCurrPortionId == intOldPortionId) {
    $('#' + portionCell + '').css("background-color", "green");
    } else {
    $('#' + portionCell + '').css("background-color", "red");
    }


    FYI, using javascript style parameter names (like backgroundColor) works fine for me here in Safari 5.1.2 and Chrome 16:

    Test fiddle

    ReplyDelete