$(document).ready(function(){
$("#cr").click(function(){
if(this.checked){ //DOM方式判断
alert("感谢你的支持!你可以继续操作!");
}
})
});为什么这样写不对呢 
$(this)
if($(this).checked){ //DOM方式判断
alert("感谢你的支持!你可以继续操作!");
}
为什么这样写不对呢 

解决方案 »

  1.   

    checked是javascript的属性,jquery没有这个属性
      

  2.   

    this 指向你操作的dom对象
    $(this) 则返回一个jQuery 对象,后者对dom对象进行了包装,所有的操作都要另外按jQuery的方法进行.
      

  3.   


    $(document).ready(function () {
            $("#cr").click(function () {
                if (this.checked) { //DOM方式判断
                    alert("感谢你的支持!你可以继续操作!");
                }
            })
        });
        $(document).ready(function () {
            $("#cr").click(function () {
                if ($(this).attr("checked")) { //Jquery方式判断
                    alert("感谢你的支持!你可以继续操作!");
                }
            })
        });
         $(document).ready(function () {
            $("#cr").click(function () {
                if ($(this)get(0).checked)){ //DOM方式判断  $(this)[0],$(this).get(0) Jquery对象转成DOM
                    alert("感谢你的支持!你可以继续操作!");
                }
            })
        });
      

  4.   


    $(document).ready(function () {
            $("#cr").click(function () {
                if ($(this).get(0).checked){ //DOM方式判断  $(this)[0],$(this).get(0) Jquery对象转成DOM
                    alert("感谢你的支持!你可以继续操作!");
                }
            })
        });上面那个  漏了 。 
      

  5.   

    $(this)是jQuery对象, this是引用的原生DOM对象