Get the ID by Class name JQuery

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

Hi this is a jquery question:

supposed i have this:





        
8条回答
  •  迷失自我
    2021-02-05 19:56

    Are you only checking one checkbox at a time?

    alert( $(".select:checked").attr('id') );

    Or, if you have multiple checkboxes checked at once:

    $(".select:checked").each(function(){
       alert($(this).attr('id'));
    });
    

    Demo: http://jsfiddle.net/UTux2/

提交回复
热议问题