0

我正在动态创建一堆按钮

<a href="#" id="btnRemove" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-close"></span>REMOVE</a>

但是我如何确定其中哪一个被点击了?

4

1 回答 1

1

如果您注册 click 事件,则此回调中的 this 变量将指向被点击的相应 DOM 元素:

$('a').click(function() {
    // this here will represent the anchor that was clicked
    return false;
});
于 2011-06-02T17:35:07.290 回答