Get the ID by Class name JQuery

前端 未结 8 1917
臣服心动
臣服心动 2021-02-05 19:00

Hi this is a jquery question:

supposed i have this:





        
8条回答
  •  渐次进展
    2021-02-05 19:41

    You aren't capturing the checked checkbox, you're only asking "is there one checked?".

    $("#submit").click(function(){
    
        var elem = $(".select:checked");
    
        if(elem.length > 0){
            alert(elem.attr('id'));
        }
    });
    

提交回复
热议问题