开发者

How to identify when a dynamic button is clicked using JQuery?

I am dynamically creating a bunch of buttons

<a href="#" id="btnRemove" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-close"></span>REMOVE</a>
开发者_运维技巧

but how do I identify which one of them was clicked?


If you register for the click event the this variable inside this callback will point to the corresponding DOM element that was clicked:

$('a').click(function() {
    // this here will represent the anchor that was clicked
    return false;
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜