Passing data to a jQuery click() function

后端 未结 5 2057
独厮守ぢ
独厮守ぢ 2021-01-01 21:21

I have a simple span like so

Remove

This span is within a table, each row has a remo

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-01 22:22

    $(this) within your click function represents the clicked element

    $(".removeAction").click(function() {
        //AJAX here that needs to know the ID
        alert($(this).attr('id'));           
    }
    

提交回复
热议问题