Jquery判断对象选中

 $(document).ready(
            function()
            {
                var $cb=$("#cb");
                var cb=$cb[0]; //转换为DOM对象后判断
                $cb.click(
                    function()
                    {
                        if(cb.checked)//转换为DOM对象后判断

                        {
                            alert("you checked");
                        }
                        else
                        {
                            alert("you have not checked");
                        }
                       
                    }
                );
            }
        );      

 

 

//Jquery判断对象选中
        $(document).ready(
            function()
            {
                var $cb=$("#cb");
                $cb.click(
                    function()
                    {
                       if($cb.is(":checked"))
                        {
                            alert("you checked");
                        }
                        else
                        {
                            alert("you have not checked");
                        }
                       
                    }
                );
            }
        );

posted @ 2012-04-21 11:17  sidihu  阅读(173)  评论(0编辑  收藏  举报