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;
});
精彩评论