Jquery 判断CheckBox是否选中

代码如下:

//通过checkbox的单击事件来判断checkbox是否选中

$('#grdList tr td').children("[type='checkbox']").click( function () {

//如果选中,增加背景颜色。否则,背景无色

if( $(this).attr("checked")==true)

{

$(this).parent().css("backgroundColor","GreenYellow");

}

else

{

$(this).parent().css("backgroundColor","");

}

});