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

クリック イベントを登録すると、このコールバック内の this 変数は、クリックされた対応する DOM 要素を指します。

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