how to get the id of button clicked in jquery

JavaScript
$("button").click(function() {
    alert(this.id); // or alert($(this).attr('id'));
});
Source

Also in JavaScript: