In your example, it will be like this:
$("#btnDel").click(function() {
alert(this.id);
});
Please note that you cannot encode the code that you have, the identifiers must be unique , you will get all kinds of side effects if this is not so, as this is invalid HTML. If you want a click handler for any input, change the selector like this:
$("input").click(function() {
alert(this.id);
});
source
share