jquery: get id from class selector

前端 未结 7 1299
离开以前
离开以前 2020-12-23 09:22

Is there any way that I can get the id of an element from something like:

Some text


        
7条回答
  •  天涯浪人
    2020-12-23 09:54

    $(".class").click(function(){
        alert($(this).attr('id'));
    });
    

    only on jquery button click we can do this class should be written there

提交回复
热议问题