阿宽

Nothing is more powerful than habit!
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Jquery 判断CheckBox是否选中

Posted on 2009-07-02 14:42  宽田  阅读(440)  评论(0编辑  收藏  举报
代码如下:
             //通过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","");
               }
            });