考试 最后一题删除与计算修订版

$(function(){
                var  SP =function(){
                    var g = 0
                var y = 0
                $(":checkbox:not([id])").each(function(index,item){
                    var ck =$(item).prop("checked");
                    if(ck){
                       
                    g ++;  
                    y += parseInt($(item).closest("tr").children().eq(3).text())
                   
                    }
                   
                })
                $(".money").text(y);
                $(".count").text(g);
             
                }
                $(":button").click(function(){
                    var x =$(this).data("del");
                    if(confirm("确定删除"+x+"?")){
                        $(this).closest("tr").remove();
                       
                    }
                    SP();
                   
                })
                $(":checkbox").change(function(){
                   SP();
                   })
               
            })
posted @ 2021-11-22 23:53  六月沉  阅读(31)  评论(0)    收藏  举报